{ "info": { "author": "Devgineers @ Atlas Systems Inc.", "author_email": "devgineers@atlas-sys.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Intended Audience :: System Administrators", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# ArchivesSpace Python Client\n\n[![Build Status](https://atlas-sys.visualstudio.com/Arcadia/_apis/build/status/Python/Packages/AtlasSystems.ArchivesSpace-Python-Client?branchName=master)](https://atlas-sys.visualstudio.com/Arcadia/_build/latest?definitionId=81&branchName=master)\n\n[![PyPI version](https://badge.fury.io/py/aspace-client.svg)](https://badge.fury.io/py/aspace-client)\n\nThe `aspace-client` Python package provides web client functionality that\ntargets the API of ArchivesSpace v2.X and up. This package was developed\nto aid ongoing and future ArchivesSpace migrations.\n\n\n## About\n\nThe `aspace` module extends the functionality of the `Session` class from the\n`requests` Python library, and attempts to provide access to all of\nArchivesSpace's REST API endpoints, while also preserving backwards\ncompatibility and supporting development tools such as Pylint. ArchivesSpace\ncurrently (May 2019) has over 250 API endpoints. Supporting and maintaining all\nof those endpoints is quite an undertaking, so new features and bug-fixes are\nprioritized based on their value to performing ongoing ArchivesSpace migrations.\n\n\n## Installation\n\n[This has a listing on PyPI!](https://pypi.org/project/aspace-client/)\n\n```bash\npip install aspace-client\n```\n\nYou can also install this project directly from the GitHub repository:\n\n```bash\npip install https://github.com/AtlasSystems/ArchivesSpace-Python-Client/zipball/master\n```\n\n## Developer Installation\n\nBelow are instructions for installing this package in \"editable\" mode. This\nwill allow you to make changes to the package and test them in real time.\n\n```bash\nAS_CLIENT_DIR=\"/path/to/aspace-client\"\ngit clone https://github.com/AtlasSystems/ArchivesSpace-Python-Client.git \"$AS_CLIENT_DIR\"\n\n# In your python project directory, or in your venv\npip install -e \"$AS_CLIENT_DIR\"\n```\n\n\n## Usage\n\n```python\nfrom aspace.client import ASpaceClient\n\nclient = ASpaceClient('http://localhost:8089', 'admin', 'admin')\n```\n\nThis will initialize a client that targets the instance of your ArchivesSpace\nAPI. This initialization will also automatically authenticate your user. There\nis an option to turn this off, if you're using this package as part of a\nlarger script, where interacting with ArchivesSpace is not the primary\ncomponent, and you're in an environment where it is not 100% certain that\nArchivesSpace is running and accessible. For that operation:\n\n```python\nfrom time import sleep\nfrom aspace.client import ASpaceClient\n\nclient = ASpaceClient(\n base_url='http://localhost:8089', # Base url for connecting to your ASpace's API.\n username='admin',\n password='admin',\n auto_authenticate=False,\n)\n\nwhile client.get('/version').status_code != 200:\n print('ArchivesSpace API is not up')\n sleep(2)\n\nclient.authenticate()\n```\n\nThere is also built-in support for the operation above, as well as built-in\nfunctionality for pulling settings from an instance of ConfigParser.\n\nIn settings.ini:\n\n```ini\n[aspace_credentials]\napi_host = 'http://aspace.cloudapp.eastus.azure.com'\nusername = 'automation-user'\npassword = 'automation-user-password'\n```\n\nIn app.py:\n\n```python\nimport configparser\n\nimport aspace\n\nconfig = configparser.ConfigParser()\nconfig.load('settings.ini')\n\nclient = (\n aspace.client.ASpaceClient\n .init_from_config(config)\n .wait_until_ready(\n check_interval=2.0,\n max_wait_time=200.0,\n authenticate_on_success=True,\n )\n)\n```\n\nFailed authentications raise an error, so if any of these scripts are still\nrunning, you're ready to query the API! This package interacts with the\nArchivesSpace API using the following considerations.\n\n1. the syntax described by the `requests` Python library that we all love and\n2. the API endpoint structure described by the docs for the ArchivesSpace API\n\nThe typical syntax of the `requests` Python library is preserved, so all HTTP\nmethods (POST, GET, DELETE, etc.) typically start with a URI or an endpoint,\nrelative to the base URL of the API. The URI is never assumed to make sure \nthat all operations are predictable, and that all of the functionality of the\nAPI is utilized correctly.\n\n### Get ArchivesSpace System Info\n\n```python\n# Get the system info\nprint(client.get('/').json())\n```\n\n### Manage Repositories\n\n```python\n\n# Get a listing of all repositories\nrepositories = client.get('/repositories').json()\nfor repository in repositories:\n print(repository)\n\n# Create a new repository\nnew_repo = {}\nnew_repo['repo_code'] = 'test_repo'\nnew_repo['name'] = 'Test Repository'\nresponse = client.post('/repositories', json=new_repo).json()\n\n# Update the name of that repository\nrepo = client.get(response['uri']).json()\nrepo['name'] = 'Andy Samberg University Archives - Test Repository'\nclient.post(repo['uri'], json=repo)\n\n# Delete the repository\nclient.delete(new_repo['uri'])\n```\n\nThis syntax can be used to interact with all of ArchivesSpace's endpoints, as\nlong as the response comes back as JSON. Most do. There are also some\nextensions to ArchivesSpace's API functionality that are currently provided.\n\n### Streaming Records\n\n```python\n# Manage your resource records one at a time, no matter how many you have\nfor resource in client.stream_records().resources():\n if resource['title'].endswith('!'):\n # Remove trailing spaces and \n print('Cleaning Resource:', resource['uri'], resource['title'])\n resource['title'] = resource['title'].rstrip('!')\n update_result = client.post(resource['uri'], json=resource).json()\n print(update_result)\n\n# Works for accessions and agents\nclient.stream_records().accessions()\nclient.stream_records().people()\nclient.stream_records().corporate_entities()\nclient.stream_records().families()\nclient.stream_records().software()\nclient.stream_records().all_agents()\n\n\n# Works for endpoints that do not have an explicitly defined stream method\nclient.stream_records().records('container_profiles'):\n pass\n\n# Works for endpoints that do not have an explicitly defined stream method\n# and require a repository reference in the URI.\nfor assessment in client.stream_records().repository_records('assessments'):\n pass\n\n# Optional limits can be placed on record streams, so that only 1 repository\n# is considered, as opposed to streaming all records from all repositories,\n# which is default.\nassessments_stream = client.stream_records().repository_records(\n 'assessments',\n repository_uris=['/repositories/2']\n)\n\nfor assessment in assessments_stream:\n pass\n```\n\n### User Management\n\n```python\n# Change all of your user's passwords to \"something really complicated\"\nclient.manage_users().change_all_passwords(\n 'pa$$w0rd',\n include_admin=True\n)\n\n# Randomize all of your non-admin user's passwords\nimport string\nimport random\n\ndef random_password():\n return ''.join(\n random.choice(string.ascii_uppercase + string.digits)\n for _ in range(25)\n )\n\n# The same password for every user\nclient.manage_users().change_all_passwords(\n new_password=random_password(),\n include_admin=False,\n)\n\n# Different password for every user\nclient.manage_users().change_all_passwords(\n new_password=lambda user: random_password(),\n include_admin=False,\n)\n```\n\n\n## Contributing\n\nIf you have any suggestions or bug reports please feel free to report them in\n[the issues tab](https://github.com/AtlasSystems/ArchivesSpace-Python-Client/issues) \nor email us at [devgineers@atlas-sys.com](mailto:devgineers@atlas-sys.com).\nFeel free to email us if you are new to Git, but would still like to \ncontribute.\n\nPull requests are welcome, but they will subject to a review process.\nConsistent code style is a goal for this project, as it currently \nattempts to follow the coding standards layed out in the \n[PEP8 Python style guide](https://www.python.org/dev/peps/pep-0008/).\nPlease keep this in mind when submitting or requesting contributions,\nbut also keep in mind that PEP is a flexible standard and that we are \nwilling to make exceptions.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/AtlasSystems/ArchivesSpace-Python-Client", "keywords": "archivesspace archives api", "license": "", "maintainer": "", "maintainer_email": "", "name": "aspace-client", "package_url": "https://pypi.org/project/aspace-client/", "platform": "", "project_url": "https://pypi.org/project/aspace-client/", "project_urls": { "Bug Reports": "https://github.com/AtlasSystems/ArchivesSpace-Python-Client/issues", "Feature Requests": "https://github.com/AtlasSystems/ArchivesSpace-Python-Client/issues", "Homepage": "https://github.com/AtlasSystems/ArchivesSpace-Python-Client", "Source": "https://github.com/AtlasSystems/ArchivesSpace-Python-Client" }, "release_url": "https://pypi.org/project/aspace-client/2.3.8/", "requires_dist": [ "requests (<3,>=2.18)" ], "requires_python": "", "summary": "Provides methods and classes that can be used when interacting with the ArchivesSpace API.", "version": "2.3.8" }, "last_serial": 5484626, "releases": { "2.3.5": [ { "comment_text": "", "digests": { "md5": "e067bd5879277f52fa5831c1fd1319b7", "sha256": "294175b66faea5aa0c29ab6e167b6fd2fd3ca6df9269a2fd0c0e273b5674396d" }, "downloads": -1, "filename": "aspace_client-2.3.5-py3-none-any.whl", "has_sig": false, "md5_digest": "e067bd5879277f52fa5831c1fd1319b7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 25537, "upload_time": "2019-05-22T17:30:59", "url": "https://files.pythonhosted.org/packages/b7/f3/b45741df9727886f985d93766722ac907b288d5ffa45b9c465fe37b7c99c/aspace_client-2.3.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cb15313453c286a3a458617378583ba1", "sha256": "eed413bbc3880e6a6fb5e9a0009d5946dfdb92260b8123c4d357e145ba9a864f" }, "downloads": -1, "filename": "aspace-client-2.3.5.tar.gz", "has_sig": false, "md5_digest": "cb15313453c286a3a458617378583ba1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23638, "upload_time": "2019-05-22T17:31:01", "url": "https://files.pythonhosted.org/packages/61/60/f8bbfb7fb68313b9d4a3aadd2ecf5323dda0ba71a6404c8c644b493549ab/aspace-client-2.3.5.tar.gz" } ], "2.3.6.post1": [ { "comment_text": "", "digests": { "md5": "7049ea27bd0046052ecb2f126ebf7233", "sha256": "196379c9077531afaf361dd741275bf4516ed1482bc9deec401b09202db533d5" }, "downloads": -1, "filename": "aspace_client-2.3.6.post1-py3-none-any.whl", "has_sig": false, "md5_digest": "7049ea27bd0046052ecb2f126ebf7233", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 26155, "upload_time": "2019-05-22T18:01:49", "url": "https://files.pythonhosted.org/packages/61/85/7be8e2cdcebe08f548e4c01320902ecf8b5d4ab6d05686edf6b474df7d81/aspace_client-2.3.6.post1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ead4f3c45aae9c936f441f7b970b771d", "sha256": "0e63a21ca46121edc698e0150d102a9c77bebc84d5032fd2915fd3c768d30972" }, "downloads": -1, "filename": "aspace-client-2.3.6.post1.tar.gz", "has_sig": false, "md5_digest": "ead4f3c45aae9c936f441f7b970b771d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24062, "upload_time": "2019-05-22T18:01:51", "url": "https://files.pythonhosted.org/packages/f1/b8/cbe91d564a023334bd784e7e55dd651c9919cc8a11b99279dd7ec87c30d7/aspace-client-2.3.6.post1.tar.gz" } ], "2.3.6.post3": [ { "comment_text": "", "digests": { "md5": "8392b7af112cd70641c662cda91d9c98", "sha256": "5f4c8f25c2f1250e06f372ef807ecdf721cca169401b94643fa1c7b4d1a69cb7" }, "downloads": -1, "filename": "aspace_client-2.3.6.post3-py3-none-any.whl", "has_sig": false, "md5_digest": "8392b7af112cd70641c662cda91d9c98", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 26155, "upload_time": "2019-05-23T12:24:03", "url": "https://files.pythonhosted.org/packages/82/64/b30b4cef22d10fa4d1a39e0b0a6479de0b95a65244d8e43cddc0944dc8cf/aspace_client-2.3.6.post3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "41968efa21ce7a4a761ca460e714a8b0", "sha256": "8b4dfef90ae1c20bbcf25c5144a31228873e648a81a778843524246dce1d2390" }, "downloads": -1, "filename": "aspace-client-2.3.6.post3.tar.gz", "has_sig": false, "md5_digest": "41968efa21ce7a4a761ca460e714a8b0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24034, "upload_time": "2019-05-23T12:24:05", "url": "https://files.pythonhosted.org/packages/37/2a/32ec13670fa28d68710fc6222b79f700e880fd949015d141121b9f956c86/aspace-client-2.3.6.post3.tar.gz" } ], "2.3.7": [ { "comment_text": "", "digests": { "md5": "e3f4b60ef8392401ccc78868d7535e8f", "sha256": "8d2acfb964861e618e8bf3ee45cc3d6ae12e14ea6b5fa7f98245233f7007821d" }, "downloads": -1, "filename": "aspace_client-2.3.7-py3-none-any.whl", "has_sig": false, "md5_digest": "e3f4b60ef8392401ccc78868d7535e8f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 26080, "upload_time": "2019-05-23T17:40:01", "url": "https://files.pythonhosted.org/packages/e8/8d/b5652a2e64969345f8081f7529c80670ac214d752cbd9e7e66cb1d5a1bb1/aspace_client-2.3.7-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9911a345c0786fec1481b1158350ace4", "sha256": "b48aa191aa58d141d5b5020d5fee827242e47fa18c5e307da5a0ae2b60efee51" }, "downloads": -1, "filename": "aspace-client-2.3.7.tar.gz", "has_sig": false, "md5_digest": "9911a345c0786fec1481b1158350ace4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24006, "upload_time": "2019-05-23T17:40:03", "url": "https://files.pythonhosted.org/packages/6e/a0/2765f43b16be0fa53938e2ebfb37de3355d8e5cab81a00ffd33a54ade892/aspace-client-2.3.7.tar.gz" } ], "2.3.7.post1": [ { "comment_text": "", "digests": { "md5": "c0c359ebea8f0e8fa8bc474327d61dc6", "sha256": "e27726efa3a3c9a06158a8e03d4e53c010b1d606a25d73e6ebf2a5fcffa575a3" }, "downloads": -1, "filename": "aspace_client-2.3.7.post1-py3-none-any.whl", "has_sig": false, "md5_digest": "c0c359ebea8f0e8fa8bc474327d61dc6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 26073, "upload_time": "2019-06-24T15:52:53", "url": "https://files.pythonhosted.org/packages/ae/9b/8bfb09b18a068b706ae26d54823747870704dd829a150c91dd9381a8a34b/aspace_client-2.3.7.post1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9754ac93a90dd679cd6b34a6d01bcf8f", "sha256": "674e9bf9cd2998f5aa0a15c7c2cbf2d92b9979d20a0ff34bff1c6cefd8d80388" }, "downloads": -1, "filename": "aspace-client-2.3.7.post1.tar.gz", "has_sig": false, "md5_digest": "9754ac93a90dd679cd6b34a6d01bcf8f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23863, "upload_time": "2019-06-24T15:52:55", "url": "https://files.pythonhosted.org/packages/35/1f/66fa2d5c8f17a62118678348d0c23d1e0301389f578e275ef2399e47a5ba/aspace-client-2.3.7.post1.tar.gz" } ], "2.3.8": [ { "comment_text": "", "digests": { "md5": "7a6c9d751dbac4b5be83b4150ba30430", "sha256": "44392cfa8da421016f6186593c36f16811e939fa628d22ae5a165f1a1ea54ddd" }, "downloads": -1, "filename": "aspace_client-2.3.8-py3-none-any.whl", "has_sig": false, "md5_digest": "7a6c9d751dbac4b5be83b4150ba30430", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 26061, "upload_time": "2019-07-04T03:42:37", "url": "https://files.pythonhosted.org/packages/4f/9a/37c6ac7a801eb975dab46eb47a56b9343b1b66c30b181efb365ed2b46bfc/aspace_client-2.3.8-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1feff32b558ff5eb8c307c7e299bc35c", "sha256": "4d5fe60e171fe538677c495dd42a7f91c4eb7f84cc0cfa1c3de358066bd85788" }, "downloads": -1, "filename": "aspace-client-2.3.8.tar.gz", "has_sig": false, "md5_digest": "1feff32b558ff5eb8c307c7e299bc35c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23989, "upload_time": "2019-07-04T03:42:38", "url": "https://files.pythonhosted.org/packages/5a/1a/a5844d0961c1eda3e9005272e9686ed83ab3d4da1d6c402931dfd8b7533a/aspace-client-2.3.8.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7a6c9d751dbac4b5be83b4150ba30430", "sha256": "44392cfa8da421016f6186593c36f16811e939fa628d22ae5a165f1a1ea54ddd" }, "downloads": -1, "filename": "aspace_client-2.3.8-py3-none-any.whl", "has_sig": false, "md5_digest": "7a6c9d751dbac4b5be83b4150ba30430", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 26061, "upload_time": "2019-07-04T03:42:37", "url": "https://files.pythonhosted.org/packages/4f/9a/37c6ac7a801eb975dab46eb47a56b9343b1b66c30b181efb365ed2b46bfc/aspace_client-2.3.8-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1feff32b558ff5eb8c307c7e299bc35c", "sha256": "4d5fe60e171fe538677c495dd42a7f91c4eb7f84cc0cfa1c3de358066bd85788" }, "downloads": -1, "filename": "aspace-client-2.3.8.tar.gz", "has_sig": false, "md5_digest": "1feff32b558ff5eb8c307c7e299bc35c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23989, "upload_time": "2019-07-04T03:42:38", "url": "https://files.pythonhosted.org/packages/5a/1a/a5844d0961c1eda3e9005272e9686ed83ab3d4da1d6c402931dfd8b7533a/aspace-client-2.3.8.tar.gz" } ] }