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.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3be30d59cef82961c20c507274463da299cbee839f5b64e798e07c06f20d7344 |
|
MD5 | 390cba3cad42fb1fe822bfcd26ab0b1a |
|
BLAKE2b-256 | 798647fd583b785dbd52faeb45bdbefd8aadedb8c6cc238f8ae7d025e5e384df |