Skip to main content

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


Homepage and documentation: https://github.com/DataBooster/PyWebApi
Copyright (c) 2020 Abel Cheng
License: MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simple_rest_call-0.1a9-py2.py3-none-any.whl (4.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file simple_rest_call-0.1a9-py2.py3-none-any.whl.

File metadata

  • Download URL: simple_rest_call-0.1a9-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.6

File hashes

Hashes for simple_rest_call-0.1a9-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9ba5feef154b26e05bc27089ded4dd8b42f5bc171d60afefb4b9351aa78e8608
MD5 312ed2211c691a9fc2ac03845c1db9aa
BLAKE2b-256 40de4c4e364994b807f9447758300d5895a8049871998da751c6c976d985a136

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page