python - 使用请求库使用 python 从 ZOHO CREATOR API 获取数据
问题描述
我正在尝试使用带有请求的 Python 3从zoho creator API获取数据。尽管我已经将 python 用于一些临时工作和数据处理,但我对 http 请求一无所知。任何人都可以帮助我使用请求将以下 html 代码翻译成等效的 python 代码吗?
<form method="GET" action="https://creator.zoho.com/api/xml/sample/view/Employee_View">
<input type="hidden" name ="authtoken" value="************">
<input type="hidden" name ="zc_ownername" value="********">
<input type="hidden" name="criteria" value='(PacienteSL=="Abilio Alfredo Finotti")'>
<input type="hidden" name ="scope" id="scope" value="creatorapi">
<input type="submit" value="View Records">
</form>
解决方案
不需要 urllib,请求会为您处理它:
import requests
url = "https://creator.zoho.com/api/xml/sample/view/Employee_View/"
params = {
"authtoken": "***",
"scope": "creatorapi",
"zc_ownername": "***",
"criteria": "(PacienteSL==\"Abilio Alfredo Finotti\")"
}
requests.get(url, params=params).content
推荐阅读
- node.js - 如何对 node.js 服务使用授权?
- delphi - 移除遮罩颜色 LWA_COLORKEY
- python - 如何使用 Python 和 Selenium 的另一列根据条件单击展开按钮?
- gem5 - 在 gem5 系统调用仿真中打开由 C++ std::ifstream 处理的二进制文件失败 is_open 检查
- swift - tvOS 13 DiffableDataSource 无效参数不满足:itemCount
- database - 如何使用 Firebase 云数据库支持聊天室中的新消息?
- spatstat - 有没有办法在标记组上调用 pcfcross 函数?
- c# - 在Unity中计算点一个给定的距离垂直于一条线在一个圆上的角度
- azure-devops - 发布管道中的文件转换任务中的“包或文件夹”指的是什么?
- php - 测试以断言选择输入中包含特定选项