简单的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中找到一个快速示例


版权所有(c)2020 Abel Cheng
许可证:麻省理工学院

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java文件路径中的java UTF8字符   java如何可靠地写入OPC UA服务器?   for-my-if语句中的java循环不能产生我想要的结果   java我如何在1个XSL中加入2个XML   macos无法在“/Library/Java/JavaVirtualMachines/jdk15.0.1.jdk/Contents/Home/bin/apt”中找到可执行文件   Java代码简单数学   java如何避免selenium中的sendKeys方法清除之前填充的文本?   java如何将PlacesAPI自动完成小部件传递到自定义对话框?   带有文本块的java Intellij json片段问题   启动时Spring启动错误:java。木卫一。IOException:jsse。别名\u否\u键\u项   移动文件时发生java异常   http Java Web客户端远程连接