简单的RESTful调用
simple-rest-call的Python项目详细描述
简单的休憩呼叫
此模块将Requests包装成一个简单的调用, 特别是JSON请求和JSON响应,支持datetime。默认情况下, 为了方便企业环境,使用Windows单点登录身份验证。在
rest(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. ^{tt1}$ will be added into the request header if the object is converted to JSON inside this function. |
method: | (default: ^{tt2}$) Method for the request: ^{tt3}$, ^{tt2}$, ^{tt5}$, ^{tt6}$, ^{tt7}$, ^{tt8}$, or ^{tt9}$. |
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. |
可以从https://github.com/DataBooster/PyWebApi/blob/master/Sample/UserApps/MdxReader/mdx_task.py中找到一个快速示例
- 项目
标签: