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
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
Hashes for jsonrequest-0.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d56764a33a0a3d17bcde6e69ee6afc3cadc56415947ea69a4119d7b1eb0953f |
|
MD5 | 7564401f2329b0761a2e4d7ce4241b67 |
|
BLAKE2b-256 | c6bd1ab4ed3e8d13b96f3fb7db6d656aaea5606fd2dbc7ae472a6d5c6c7ca697 |