首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用python使用请求库从ZOHO CREATOR API获取数据

使用python使用请求库从ZOHO CREATOR API获取数据
EN

Stack Overflow用户
提问于 2019-09-03 03:48:16
回答 2查看 641关注 0票数 1

我正在尝试使用带有请求的Python3从zoho creator API获取数据。尽管我用python做过一些临时工作和数据处理,但我对http请求一无所知。有没有人能帮我把下面的html代码翻译成使用请求的等效python代码?

代码语言:javascript
复制
<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>
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2019-09-11 04:25:40

我已经成功地使用urllib的请求来进行这种类型的调用-下面这样的东西应该可以翻译上面的html。

代码语言:javascript
复制
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
票数 2
EN

Stack Overflow用户

发布于 2020-03-17 07:14:19

不需要urllib,requests会为你处理它:

代码语言:javascript
复制
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
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57762017

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档