使用请求库从 ZOHO CREATOR API 和 python 获取数据
Fetch data from ZOHO CREATOR API with python using requests library
我正在尝试使用 Python 3 和 Requests 从 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 的请求来进行此类调用取得了一些成功 - 类似下面的内容应该翻译上面的内容 html。
import requests
import urllib
param = urllib.parse.urlencode({"authtoken":"token_here",
"scope":"creatorapi",
"zc_ownername":"owner_here",
"criteria":'(PacienteSL=="Abilio Alfredo Finotti")'})
url = "https://creator.zoho.com/api/xml/{0}/view/{1}/{2}".format("sample", "Employee_View", param)
requests.get(url).content
无需 urllib,requests 会为您处理:
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
我正在尝试使用 Python 3 和 Requests 从 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 的请求来进行此类调用取得了一些成功 - 类似下面的内容应该翻译上面的内容 html。
import requests
import urllib
param = urllib.parse.urlencode({"authtoken":"token_here",
"scope":"creatorapi",
"zc_ownername":"owner_here",
"criteria":'(PacienteSL=="Abilio Alfredo Finotti")'})
url = "https://creator.zoho.com/api/xml/{0}/view/{1}/{2}".format("sample", "Employee_View", param)
requests.get(url).content
无需 urllib,requests 会为您处理:
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