{"id":35619716,"url":"https://github.com/scieloorg/opac_ssm_api","last_synced_at":"2026-01-05T06:03:48.863Z","repository":{"id":15725852,"uuid":"78664917","full_name":"scieloorg/opac_ssm_api","owner":"scieloorg","description":"GRPC API Client of OPAC SSM","archived":false,"fork":false,"pushed_at":"2025-06-18T11:46:10.000Z","size":81,"stargazers_count":2,"open_issues_count":19,"forks_count":6,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-06-18T12:47:26.397Z","etag":null,"topics":["api","grpc","grpc-api","opac-ssm"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scieloorg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-01-11T18:01:47.000Z","updated_at":"2023-01-31T16:47:14.000Z","dependencies_parsed_at":"2023-02-19T11:40:18.702Z","dependency_job_id":"23257181-0157-4d39-ad87-beca34973f76","html_url":"https://github.com/scieloorg/opac_ssm_api","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/scieloorg/opac_ssm_api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scieloorg%2Fopac_ssm_api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scieloorg%2Fopac_ssm_api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scieloorg%2Fopac_ssm_api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scieloorg%2Fopac_ssm_api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scieloorg","download_url":"https://codeload.github.com/scieloorg/opac_ssm_api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scieloorg%2Fopac_ssm_api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28214409,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2026-01-05T02:00:06.358Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","grpc","grpc-api","opac-ssm"],"created_at":"2026-01-05T06:02:29.453Z","updated_at":"2026-01-05T06:03:48.858Z","avatar_url":"https://github.com/scieloorg.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"OPAC SSM GRPC API\n===============================\n\nversion number: 0.1.4\nauthor: SciELO\n\nBadges:\n-------\n[![Code Health](https://landscape.io/github/scieloorg/opac_ssm_api/master/landscape.svg?style=flat)](https://landscape.io/github/scieloorg/opac_ssm_api/master)\n[![Updates](https://pyup.io/repos/github/scieloorg/opac_ssm_api/shield.svg)](https://pyup.io/repos/github/scieloorg/opac_ssm_api/)\n\nOverview\n--------\n\ngRPC API of OPAC-SSM service\n\nInstallation / Usage\n--------------------\n\nTo install use pip:\n\n    $ pip install -e git+https://git@github.com/scieloorg/opac_ssm_api@v0.1.4#egg=opac_ssm_api\n\n\nOr clone the repo:\n\n    $ git clone git@github.com:scieloorg/opac_ssm_api.git\n    $ python setup.py install\n\nAPI Usage\n---------\n\nCreate any instance of client and add new asset, return id of the task:\n\n```python\nfrom opac_ssm_api.client import Client\ncli = Client()\ncli.add_asset(pfile='data/fixtures/sample.img')\n'3fcc9270-1740-44a3-86ad-8b0a1b7b9774'\n```\n\nGet any exist asset:\n\n```python\nfrom opac_ssm_api.client import Client\ncli = Client()\ncli.get_asset('3fcc9270-1740-44a3-86ad-8b0a1b7b9774')\n(True,\n{'bucket': 'UNKNOW',\n'file': b'#!/usr/bin/env bash\\n\\n# build the docs\\ncd docs\\nmake clean\\nmake html\\ncd ..\\n\\n# commit and push\\ngit add -A\\ngit commit -m \"building and pushing docs\"\\ngit push origin master\\n\\n# switch branches and pull the data we want\\ngit checkout gh-pages\\nrm -rf .\\ntouch .nojekyll\\ngit checkout master docs/build/html\\nmv ./docs/build/html/* ./\\nrm -rf ./docs\\ngit add -A\\ngit commit -m \"publishing updated docs...\"\\ngit push origin gh-pages\\n\\n# switch back\\ngit checkout master',\n'filename': 'update_docs.sh',\n'metadata': '{}',\n'type': '',\n'uuid': '3fcc9270-1740-44a3-86ad-8b0a1b7b9774'})\n```\n\nGet any inexist asset:\n\n```python\nfrom opac_ssm_api.client import Client\ncli = Client()\ncli.get_asset('3fcc9270-1740-44a3-86ad-8b0a1b7b9774')\n(False, {'error_message': 'Asset matching query does not exist.'})\n```\n\nGet URLs from asset:\n\n```python\nfrom opac_ssm_api.client import Client\ncli = Client()\n# Exist asset\ncli.get_asset_info('3fcc9270-1740-44a3-86ad-8b0a1b7b9774')\n(True, {'url': 'http://localhost:8001/media/assets/1248/update_docs_w7s25ZB.sh',\n       'url_path': '/media/assets/1248/update_docs_w7s25ZB.sh'})\n\n# Unexist asset\ncli.get_asset_info('3fcc9270-1740-44a3-86ad-8b0a1b7b9774')\n(False, {'error_message': 'Asset matching query does not exist.'})\n```\n\nGet task state:\n\n```python\nfrom opac_ssm_api.client import Client\ncli = Client()\ncli.get_task_state('3fcc9270-1740-44a3-86ad-8b0a1b7b9774')\n'SUCCESS'\n```\n\nUpdate asset:\n\n```python\nfrom opac_ssm_api.client import Client\ncli = Client()\nhelp(cli.update_asset)\nUpdate asset to SSM.\n\nParams:\n    :param uuid: uuid to update\n    :param pfile: pfile path (Mandatory) or a file pointer\n    :param filetype: string\n    :param metadata: dict\n    :param filename: filename is mandatory if pfile is a file pointer\n    :param bucket_name: name of bucket\n\nReturn id of the asset, string of (UUID4)\n\nRaise ValueError if param uuid is not a str|unicode\n\ncli.update_asset(uuid='3fcc9270-1740-44a3-86ad-8b0a1b7b9774', filetype=\"jpg\")\ncli.get_task_state('3fcc9270-1740-44a3-86ad-8b0a1b7b9774')\n'SUCESS'\ncli.get_asset('3fcc9270-1740-44a3-86ad-8b0a1b7b9774')\n(True, {'bucket': 'UNKNOW',\n        'file': b'A\\xd8\\x01\\x00',\n        'filename': '_mdb_catalog.wt',\n        'metadata': '{}',\n        'type': 'jpg',\n        'uuid': '3fcc9270-1740-44a3-86ad-8b0a1b7b9774'})\n```\n\nRemove any asset by id:\n\n```python\nfrom opac_ssm_api.client import Client\ncli = Client()\ncli.remove_asset('3fcc9270-1740-44a3-86ad-8b0a1b7b9774')\n'd9180f82-eb22-4c9c-b25c-56747986303c'\ncli.get_task_state('d9180f82-eb22-4c9c-b25c-56747986303c')\n'SUCCESS'\ncli.get_asset('d9180f82-eb22-4c9c-b25c-56747986303c')\n(False, {'error_message': 'Asset matching query does not exist.'})\n```\n\n\nCreate a new bucket, return id of the task:\n\n```python\ncli.add_bucket('sample')\n'1d0ce52b-106f-4975-8827-07ea6f8ea573'\n````\n\nCreate a new bucket, get the task id and check status:\n\n```python\ncli.add_bucket('sample')\n'1d0ce52b-106f-4975-8827-07ea6f8ea573'\ncli.get_task_state('1d0ce52b-106f-4975-8827-07ea6f8ea573')\n'SUCCESS'\n````\n\nThe method ``get_task_state`` can return ['PENDING', 'STARTED', 'RETRY', 'FAILURE', 'SUCCESS']\n\nRemove any bucket\n\n```python\ncli.remove_bucket('sample')\n'b41d4912-cb34-4dc6-b862-f67e8257b112'\ncli.get_task_state('b41d4912-cb34-4dc6-b862-f67e8257b112')\n'SUCCESS'\n````\n\nCreate a new bucket and update name, get the task id and check status:\n\n```python\ncli.add_bucket('sample')\n'1d0ce52b-106f-4975-8827-07ea6f8ea573'\ncli.update_bucket('sample', 'rename_sample')\ncli.get_task_state('1d0ce52b-106f-4975-8827-07ea6f8ea573')\n'SUCCESS'\n````\n\nGRPC Server\n===========\n\nCommand to generate GRPC class:\n\n    python -m grpc_tools.protoc -I opac_ssm_api --python_out=opac_ssm_api --grpc_python_out=opac_ssm_api opac_ssm_api/opac.proto\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscieloorg%2Fopac_ssm_api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscieloorg%2Fopac_ssm_api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscieloorg%2Fopac_ssm_api/lists"}