Simple RESTful Call
Project description
simple_rest_call
This module wraps Requests into a simple call, specifically for JSON-request and JSON-response with datetime support. By default, Windows single sign-on authentication is used for convenience in enterprise environment.
request_json(url:str, data=None, method:str='POST', auth=(None,None), **kwargs)
- url:
The URL for the RESTful call.
- data:
The payload to be passed in the request body. Any incoming Python object will be encoded as JSON content except it is already a string or bytes. Content-Type: application/json; charset=utf-8 will be added into the request header if the object is converted to JSON inside this function.
- method:
(default: POST) Method for the request: GET, POST, PUT, PATCH, DELETE, OPTIONS, or HEAD.
- auth:
(The user’s default credentials are used for Windows single sign-on by default) Auth tuple to enable Basic/Digest/Custom HTTP Auth.
- kwargs:
(optional) Please refer to https://requests.readthedocs.io for other optional arguments.
- return:
A JSON decoded object if the response content type is a valid JSON, otherwise the text content will be tried to return.
A quick example can be found from https://github.com/DataBooster/PyWebApi/blob/master/Sample/UserApps/MdxReader/mdx_task.py
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 Distributions
Built Distribution
Hashes for simple_rest_call-0.1a5-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 603685a465b4ec4b9c668b7548031c8262cec330e0c7d2f8c1122aadd3a599bc |
|
MD5 | 2a3e8ae80e811027e130d2cc82cc3368 |
|
BLAKE2b-256 | b06067007a9ad3124c62ba50a336d63659075e138d34bde19e299ea8e2c91180 |