Lightweight wrapper to make http(s) requests. POST, PATCH, and DELETE requests only support json content.
Project description
JSONRequest
Lightweight wrapper for requests library that only supports Content-Type: application/json.
This only supports GET
, POST
, PATCH
, and DELETE
http(s) request methods.
How to Use
First, install the package
pip install jsonrequest
Then, you can use the package.
>>> from jsonrequest.jsonrequest import RequestModel, make_request
>>> r = make_request(RequestModel(endpoint="", method='GET', url='https://google.com'))
>>> r
<Response [200]>
>>>
Note:
This data passed also only applies to application/json
content.
Across multiple times over the past many years in my python projects, I found this codeblock repeated whenever I tried to make various http(s) requests using the requests library and thought it'd be much simpler to pass the method as a parameter instead of changing the function. I created this package as a result. Hope this helps and Happy coding :)
- by Justin
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file jsonrequest_JustinRWong-0.1.3.tar.gz
.
File metadata
- Download URL: jsonrequest_JustinRWong-0.1.3.tar.gz
- Upload date:
- Size: 2.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8de89dd199754d60d495c0ae6e069ba05cd3adfcfa2b6368f1ea6a5a4969fe5c |
|
MD5 | 1ec48c60ffe4b4941b3da32523997a55 |
|
BLAKE2b-256 | 1381273ceef90b0ceb33de0a032c2f3ae9c5037f655f91249af330c677fab87f |
File details
Details for the file jsonrequest_JustinRWong-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: jsonrequest_JustinRWong-0.1.3-py3-none-any.whl
- Upload date:
- Size: 1.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3c588a1d27785ead264085ec95910851e33de84c2838096ad7800faa1bb2d86 |
|
MD5 | 40eb54b2cfd29fc7b35f36d16724b721 |
|
BLAKE2b-256 | e19b1c5d10aed80328f27063b6025b3c0be9745d9d225cc88d6e982b2d0fa00b |