quick_rest
A versatile wrapper for REST APIs.
Dependencies
The sole non-builtin dependency is requests.
Installation
Use pip to install.
python -m pip install quick_rest
Usage
No full documentation at this time, maybe someday I'll get around to it...
You can get and post right now, and use the auth methods listed below. You can pass any requests get or post kwarg in on the Client.get and Client.post methods.
Authentication
You can currently use no authentication, key authentication and JWT authentication.
No Authentication
from quick_rest import Client
url = 'https://cat-fact.herokuapp.com/'
client = Client(url)
route = 'facts'
response = client.get(route)
Key
from quick_rest import KeyClient
url = 'https://www.haloapi.com/'
creds = {'keyname': 'somekeyhere'}
client = KeyClient(url, creds)
route = 'stats/hw2/xp?players=LamerLink' # check out my sweet Halo stats
response = client.get(route)
JWT (JSON Web Token)
from quick_rest import JWTClient
url = 'https://some-jwt-client.com/'
creds = {'username': 'someusername', 'password': 'somepassword'}
# We need to specify the names for the auth_route, token_name, and jwt_key_name.
client = JWTClient(url, creds, 'auth', 'access_token', 'Authorization')
route = 'v0/some/route/results.json'
response = client.get(route)
Results
Results come in the form of a ServerResponse object. You can access the raw_content attribute or use the decode, get_value, to_txt and to_csv methods to get the data from the object.
raw_response = response.raw_response
decoded_response = response.decode() # utf-8 by default
decoded_response = response.decode(encoding='utf-16')
value = response.get_value(key_name)
response.to_txt('some/path/file.txt') # dumps the raw response to file
response.to_csv('some/path/file.csv')
# By default, to_csv sets \n to lineterminator and writes the header to file
response.to_csv('some/path/file.csv', lineterminator='\t', omit_header=True)
Issues/Suggestions
Please make any suggestions or issues on the Github page.
To Do
- Tests.
- Oauth client.
License
This project is licensed under the MIT License. Please see the LICENSE.md file for details.
Metadata
Release files for quick-rest 0.1.9
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 | Actions |
|---|---|---|---|---|
| quick_rest-0.1.9.tar.gz | 5.4 kB | Without provenance | Details for quick_rest-0.1.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| quick_rest-0.1.9-py3-none-any.whl | Python 3 | none | any | Details for quick_rest-0.1.9-py3-none-any.whl |
Total release size: 11.7 kB
Release files / quick_rest-0.1.9.tar.gz
| Download URL | quick_rest-0.1.9.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cb0bb002a3181a7198d4faa11bd4c381ae2b2cc1a43ef60a5dd72bc1c6826046
|
|
BLAKE2b-256 checksum How to use checksums |
f0464fd3396c24bf5e6f94bc58c95d8d197c1984c4dc54fb698ecd3a68160e40
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.6
|
Release files / quick_rest-0.1.9-py3-none-any.whl
| Download URL | quick_rest-0.1.9-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e3c4ae4ec0346cd7d31c351cb0d6b805de03a2aa145f881d8c6c59508f9c21cb
|
|
BLAKE2b-256 checksum How to use checksums |
2aa34cacd277c2bf7629c9ffa0f2815b2bb22236a78cdbbf9999c6daef9e1420
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.6
|
Security for quick-rest 0.1.9
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.