Python Quizlet API错误“;使用空操作“quot;调用setAction;?
我试图用Python编写一个脚本,使用Quizlet API搜索包含特定术语的集合。唯一的问题是我得到了这个错误:Python Quizlet API错误“;使用空操作“quot;调用setAction;?,python,api,Python,Api,我试图用Python编写一个脚本,使用Quizlet API搜索包含特定术语的集合。唯一的问题是我得到了这个错误: {“http\u code”:400,“error”:“client\u developer\u error”,“error\u title”:“error”,“error\u description”:“setAction调用空操作”} 以下是脚本: import requests import os id = '' key = '' def err_fill_out():
{“http\u code”:400,“error”:“client\u developer\u error”,“error\u title”:“error”,“error\u description”:“setAction调用空操作”}
以下是脚本:
import requests
import os
id = ''
key = ''
def err_fill_out():
print '[-] Please fill out your terms.txt file'
exit(1)
if os.path.exists('terms.txt'):
print '[*] Found terms.txt ...'
terms = [i.strip() for i in open('terms.txt', 'r+').readlines()]
if len(terms) == 0:
err_fill_out()
for i in terms:
print '[*] Looking for best term of', i, '...'
r = requests.post(url='https://api.quizlet.com/2.0/search/sets', data={"client_id": id, "access_token": key, "term": i, "sort": "most_studied"})
print r.text
else:
open('terms.txt', 'w+')
err_fill_out()
看来你的要求不太对。我不知道你发布的代码是如何产生错误的 再次检查文档页面: 有几件事:
- 应该是
get
- 需要参数
而不是q
term
已折旧排序
r = requests.get(url='https://api.quizlet.com/2.0/search/sets', params={"client_id": id, "access_token": key, "q": i})
看来你的要求不太对。我不知道你发布的代码是如何产生错误的 再次检查文档页面: 有几件事:
- 应该是
get
- 需要参数
而不是q
term
已折旧排序
r = requests.get(url='https://api.quizlet.com/2.0/search/sets', params={"client_id": id, "access_token": key, "q": i})