Name | ua-generic-rest-api JSON |
Version |
2.0.6
JSON |
| download |
home_page | |
Summary | Provides basic REST API Implementation for GET, PUT, and POST, and DELETE. |
upload_time | 2023-11-21 23:12:13 |
maintainer | |
docs_url | None |
author | Your Name |
requires_python | >=3.11,<4.0 |
license | |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# UA-Generic-Rest-Api
Provides basic REST API Implementation for GET, PUT, and POST, and DELETE.
## Motivation
Was designed to remove similarities among REST API implementations by creating a generic REST API that classes can be extended and override for specific needs.
## Features
- GET - Implementation of GET which can single GET, batch GET, single GET with query, and GET every page on a paginated endpoint.
- Batch gets with queries are unavailable as there is no way to give each get a unique query. Because of this the feature was not included.
- PUT - Basic implementation of PUT which puts the payload to the given endpoint.
- POST - Basic implementation of POST which posts the payload to the given endpoint.
- DELETE - Basic implementation of DELETE which deletes the given endpoint.
## Code Example
```python
from ua_generic_rest_api import GenericRestApi
class SpecificRestApi(GenericRestApi):
# Replace '...' with any other initialization arguments.
def __init__(self, ...):
# host, header_info, page_query, and page_tag are site specific.
# Set them to your own values.
super().__init__(host, header_info, page_query, page_tag=page_tag)
# Can override GET, PUT, POST, or DELETE here.
```
- host - The base url for the endpoint that is to be gotten.
- header_info - Any information to be added to a request header such as Authorization or Content-Type.
- Should be in the form of a dictionary, such as {"Authorization": None, "Content-Type": "text/xml"}.
- page_query - The tag to use when querying for specific pages.
- For example, for sites queried with the tag "?page=", page_query should be "page".
- page_tag - The tag name of paginated endpoints to search for when getting data.
- For sites paginated with the tag "page", page_tag should be "page".
## Installation
```bash
pip install ua-generic-rest-api
pip install -r requirements.txt
```
## Tests
- Tests are only necessary when wanting to make changes to the module.
```bash
pip install --update node
cd ./ua_generic_rest_api
cd ./tests
nosetests test_generic_rest_api.py
```
## Credits
[sterns1](sterns1@github.com)
[EtienneThompson](EtienneThompson@github.com)
## License
MIT
Raw data
{
"_id": null,
"home_page": "",
"name": "ua-generic-rest-api",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.11,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "Your Name",
"author_email": "you@example.com",
"download_url": "https://files.pythonhosted.org/packages/84/15/1a92ff26530921aa27c36638eda0e217e669c623de0091483bb8a9e3d03e/ua_generic_rest_api-2.0.6.tar.gz",
"platform": null,
"description": "# UA-Generic-Rest-Api\n\nProvides basic REST API Implementation for GET, PUT, and POST, and DELETE.\n\n## Motivation\n\nWas designed to remove similarities among REST API implementations by creating a generic REST API that classes can be extended and override for specific needs.\n\n## Features\n\n- GET - Implementation of GET which can single GET, batch GET, single GET with query, and GET every page on a paginated endpoint.\n - Batch gets with queries are unavailable as there is no way to give each get a unique query. Because of this the feature was not included.\n- PUT - Basic implementation of PUT which puts the payload to the given endpoint.\n- POST - Basic implementation of POST which posts the payload to the given endpoint.\n- DELETE - Basic implementation of DELETE which deletes the given endpoint.\n\n## Code Example\n\n```python\nfrom ua_generic_rest_api import GenericRestApi\n\nclass SpecificRestApi(GenericRestApi):\n # Replace '...' with any other initialization arguments.\n def __init__(self, ...):\n # host, header_info, page_query, and page_tag are site specific.\n # Set them to your own values.\n super().__init__(host, header_info, page_query, page_tag=page_tag)\n\n # Can override GET, PUT, POST, or DELETE here.\n```\n\n- host - The base url for the endpoint that is to be gotten.\n- header_info - Any information to be added to a request header such as Authorization or Content-Type.\n - Should be in the form of a dictionary, such as {\"Authorization\": None, \"Content-Type\": \"text/xml\"}.\n- page_query - The tag to use when querying for specific pages.\n - For example, for sites queried with the tag \"?page=\", page_query should be \"page\".\n- page_tag - The tag name of paginated endpoints to search for when getting data.\n - For sites paginated with the tag \"page\", page_tag should be \"page\".\n\n## Installation\n\n```bash\npip install ua-generic-rest-api\npip install -r requirements.txt\n```\n\n## Tests\n\n- Tests are only necessary when wanting to make changes to the module.\n\n```bash\npip install --update node\ncd ./ua_generic_rest_api\ncd ./tests\nnosetests test_generic_rest_api.py\n```\n\n## Credits\n\n[sterns1](sterns1@github.com)\n[EtienneThompson](EtienneThompson@github.com)\n\n## License\n\nMIT\n",
"bugtrack_url": null,
"license": "",
"summary": "Provides basic REST API Implementation for GET, PUT, and POST, and DELETE.",
"version": "2.0.6",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "df910d5c344389f854bdbe49ccc3310ace8ef404b4e581f78650080e97444e6c",
"md5": "caff5aa24e16359eb446728decea5369",
"sha256": "5cbe9e9ee092f56d6cd3054212df02498988a683e507dc64b00d9dac8dacc8c4"
},
"downloads": -1,
"filename": "ua_generic_rest_api-2.0.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "caff5aa24e16359eb446728decea5369",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11,<4.0",
"size": 7172,
"upload_time": "2023-11-21T23:12:11",
"upload_time_iso_8601": "2023-11-21T23:12:11.536645Z",
"url": "https://files.pythonhosted.org/packages/df/91/0d5c344389f854bdbe49ccc3310ace8ef404b4e581f78650080e97444e6c/ua_generic_rest_api-2.0.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "84151a92ff26530921aa27c36638eda0e217e669c623de0091483bb8a9e3d03e",
"md5": "8e5999081b94414af5e5116c031e5ec3",
"sha256": "1400e213dfbbd56d630e54822cc3b8483bd44300146e6b2bb07c3ceff4f49dc4"
},
"downloads": -1,
"filename": "ua_generic_rest_api-2.0.6.tar.gz",
"has_sig": false,
"md5_digest": "8e5999081b94414af5e5116c031e5ec3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11,<4.0",
"size": 5999,
"upload_time": "2023-11-21T23:12:13",
"upload_time_iso_8601": "2023-11-21T23:12:13.066706Z",
"url": "https://files.pythonhosted.org/packages/84/15/1a92ff26530921aa27c36638eda0e217e669c623de0091483bb8a9e3d03e/ua_generic_rest_api-2.0.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-21 23:12:13",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "ua-generic-rest-api"
}