Rest Wrapper
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:
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:
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 and the fedejaure/cookiecutter-modern-pypackage project template.
Metadata
Release files for rest-wrapper 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| rest_wrapper-0.0.3.tar.gz | 5.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rest_wrapper-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.3 kB
Release files / rest_wrapper-0.0.3.tar.gz
| Download URL | rest_wrapper-0.0.3.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d9025677ece84a7120ccc6ae20cb61a16572ca6b3f144c65904a3e2b996784aa
|
|
BLAKE2b-256 checksum How to use checksums |
7c8726b14734e8c9ff234a436269697310f9aebb907fb04cc8de25c484f74f1b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.8.12 Darwin/22.1.0
|
Release files / rest_wrapper-0.0.3-py3-none-any.whl
| Download URL | rest_wrapper-0.0.3-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9601063bf23c4d453d06acf84c0be463a0c0944bbe6999b58c9ab0ad44bb8649
|
|
BLAKE2b-256 checksum How to use checksums |
6ad078548750830ec294eaffe6dd87cfdd03c35b857b7b962d53683342647087
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.8.12 Darwin/22.1.0
|
Security for rest-wrapper 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.