rest-wrapper


Namerest-wrapper JSON
Version 0.0.3 PyPI version JSON
download
home_pagehttps://github.com/nat5142/rest-wrapper
SummarySimple, extendable base rest client for python
upload_time2024-02-14 22:05:47
maintainer
docs_urlNone
authorNick Tulli
requires_python>=3.8,<3.12
license
keywords rest-wrapper
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Rest Wrapper


<div align="center">

[![PyPI - Version](https://img.shields.io/pypi/v/rest-wrapper.svg)](https://pypi.python.org/pypi/rest-wrapper)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/rest-wrapper.svg)](https://pypi.python.org/pypi/rest-wrapper)
[![Tests](https://github.com/nat5142/rest-wrapper/workflows/tests/badge.svg)](https://github.com/nat5142/rest-wrapper/actions?workflow=tests)
[![Codecov](https://codecov.io/gh/nat5142/rest-wrapper/branch/main/graph/badge.svg)](https://codecov.io/gh/nat5142/rest-wrapper)
[![Read the Docs](https://readthedocs.org/projects/rest-wrapper/badge/)](https://rest-wrapper.readthedocs.io/)
[![PyPI - License](https://img.shields.io/pypi/l/rest-wrapper.svg)](https://pypi.python.org/pypi/rest-wrapper)

[![Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)


</div>


Simple, extendable base rest client for python. I've rewritten this pattern time after time, figured I would just package it and install when necessary.


* GitHub repo: <https://github.com/nat5142/rest-wrapper.git>
* Documentation: <https://rest-wrapper.readthedocs.io>
* Free software: MIT


## Features

Rest Wrapper provides a simple exposure of the `requests` module. Just provide a `base_url` to target and go from there:

```python
from rest_wrapper import RestClient

client = RestClient('https://example.com/')

# make a GET request. just provide an endpoint to append it to your base_url
resp = client.get('users/1/info')

# POST request
resp = client.post('users', json={'name': 'nick', 'username': 'nat5142'})  # kwargs are passed directly to the request itself

# don't append, just request any full URL:
resp = client.get('https://www.google.com/search?q=cats', append_url=False)
```

Or, use the client to make constructing your own API Wrappers easier:

```python
import os
from rest_wrapper import RestClient


class SomeApiWrapper(RestClient):
    base_url = 'https://some-api.com/'

    def authenticate(self):
        # authenticate method is invoked at the end of the object intialization.
        self.session.headers.update({
            'X-Api-Key': os.environ['API_KEY']
        })


client = SomeApiWrapper()

resp = client.get('/api/v1/users')  # will request https://some-api.com/api/v1/users
```

## Credits

This package was created with [Cookiecutter][cookiecutter] and the [fedejaure/cookiecutter-modern-pypackage][cookiecutter-modern-pypackage] project template.

[cookiecutter]: https://github.com/cookiecutter/cookiecutter
[cookiecutter-modern-pypackage]: https://github.com/fedejaure/cookiecutter-modern-pypackage

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/nat5142/rest-wrapper",
    "name": "rest-wrapper",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<3.12",
    "maintainer_email": "",
    "keywords": "rest-wrapper",
    "author": "Nick Tulli",
    "author_email": "ntulli.dev@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/7c/87/26b14734e8c9ff234a436269697310f9aebb907fb04cc8de25c484f74f1b/rest_wrapper-0.0.3.tar.gz",
    "platform": null,
    "description": "\n# Rest Wrapper\n\n\n<div align=\"center\">\n\n[![PyPI - Version](https://img.shields.io/pypi/v/rest-wrapper.svg)](https://pypi.python.org/pypi/rest-wrapper)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/rest-wrapper.svg)](https://pypi.python.org/pypi/rest-wrapper)\n[![Tests](https://github.com/nat5142/rest-wrapper/workflows/tests/badge.svg)](https://github.com/nat5142/rest-wrapper/actions?workflow=tests)\n[![Codecov](https://codecov.io/gh/nat5142/rest-wrapper/branch/main/graph/badge.svg)](https://codecov.io/gh/nat5142/rest-wrapper)\n[![Read the Docs](https://readthedocs.org/projects/rest-wrapper/badge/)](https://rest-wrapper.readthedocs.io/)\n[![PyPI - License](https://img.shields.io/pypi/l/rest-wrapper.svg)](https://pypi.python.org/pypi/rest-wrapper)\n\n[![Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)\n\n\n</div>\n\n\nSimple, extendable base rest client for python. I've rewritten this pattern time after time, figured I would just package it and install when necessary.\n\n\n* GitHub repo: <https://github.com/nat5142/rest-wrapper.git>\n* Documentation: <https://rest-wrapper.readthedocs.io>\n* Free software: MIT\n\n\n## Features\n\nRest Wrapper provides a simple exposure of the `requests` module. Just provide a `base_url` to target and go from there:\n\n```python\nfrom rest_wrapper import RestClient\n\nclient = RestClient('https://example.com/')\n\n# make a GET request. just provide an endpoint to append it to your base_url\nresp = client.get('users/1/info')\n\n# POST request\nresp = client.post('users', json={'name': 'nick', 'username': 'nat5142'})  # kwargs are passed directly to the request itself\n\n# don't append, just request any full URL:\nresp = client.get('https://www.google.com/search?q=cats', append_url=False)\n```\n\nOr, use the client to make constructing your own API Wrappers easier:\n\n```python\nimport os\nfrom rest_wrapper import RestClient\n\n\nclass SomeApiWrapper(RestClient):\n    base_url = 'https://some-api.com/'\n\n    def authenticate(self):\n        # authenticate method is invoked at the end of the object intialization.\n        self.session.headers.update({\n            'X-Api-Key': os.environ['API_KEY']\n        })\n\n\nclient = SomeApiWrapper()\n\nresp = client.get('/api/v1/users')  # will request https://some-api.com/api/v1/users\n```\n\n## Credits\n\nThis package was created with [Cookiecutter][cookiecutter] and the [fedejaure/cookiecutter-modern-pypackage][cookiecutter-modern-pypackage] project template.\n\n[cookiecutter]: https://github.com/cookiecutter/cookiecutter\n[cookiecutter-modern-pypackage]: https://github.com/fedejaure/cookiecutter-modern-pypackage\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Simple, extendable base rest client for python",
    "version": "0.0.3",
    "project_urls": {
        "Bug Tracker": "https://github.com/nat5142/rest-wrapper/issues",
        "Documentation": "https://rest-wrapper.readthedocs.io",
        "Homepage": "https://github.com/nat5142/rest-wrapper",
        "Repository": "https://github.com/nat5142/rest-wrapper"
    },
    "split_keywords": [
        "rest-wrapper"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6ad078548750830ec294eaffe6dd87cfdd03c35b857b7b962d53683342647087",
                "md5": "8a11a76edbc3420044dd544c2873d0cd",
                "sha256": "9601063bf23c4d453d06acf84c0be463a0c0944bbe6999b58c9ab0ad44bb8649"
            },
            "downloads": -1,
            "filename": "rest_wrapper-0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8a11a76edbc3420044dd544c2873d0cd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<3.12",
            "size": 5687,
            "upload_time": "2024-02-14T22:05:44",
            "upload_time_iso_8601": "2024-02-14T22:05:44.950211Z",
            "url": "https://files.pythonhosted.org/packages/6a/d0/78548750830ec294eaffe6dd87cfdd03c35b857b7b962d53683342647087/rest_wrapper-0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7c8726b14734e8c9ff234a436269697310f9aebb907fb04cc8de25c484f74f1b",
                "md5": "8413c62f1a04be52d8841929221c4d10",
                "sha256": "d9025677ece84a7120ccc6ae20cb61a16572ca6b3f144c65904a3e2b996784aa"
            },
            "downloads": -1,
            "filename": "rest_wrapper-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "8413c62f1a04be52d8841929221c4d10",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<3.12",
            "size": 5603,
            "upload_time": "2024-02-14T22:05:47",
            "upload_time_iso_8601": "2024-02-14T22:05:47.880328Z",
            "url": "https://files.pythonhosted.org/packages/7c/87/26b14734e8c9ff234a436269697310f9aebb907fb04cc8de25c484f74f1b/rest_wrapper-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-14 22:05:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "nat5142",
    "github_project": "rest-wrapper",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "rest-wrapper"
}
        
Elapsed time: 0.36334s