from pypodio2 import api
# Authenticate as App
podio_client = api.OAuthAppClient(
client_id=PODIO_CLIENT_ID,
client_secret=PODIO_CLIENT_SECRET,
app_id=PODIO_APP_ID,
app_token=PODIO_APP_TOKEN,
)
# Set limit to 100
items = podio_client.Item.filter(app_id=PODIO_APP_ID, attributes={}, limit=100)
我的应用程序总共有251个项目,我希望API会返回100个项目,但仅返回20个...如何解决此问题?
print(items ['total'])
251
print(items ['filtered'])
251
print(len(items ['items'])
20
更新
我在请求库中尝试过,但仍然没有成功...
import requests
payload = {
"filters":{},
"limit": 30
}
resp = requests.post(url="https://api.podio.com/item/app/randomappid/filter/",
headers={'authorization': 'OAuth2 randomn0mber'},
data=payload)
len(resp.json()['items'])
20
API调用文档:https://developers.podio.com/doc/items/filter-items-4496747
答案 0 :(得分:3)
limit
必须通过attributes
参数。
# Set limit to 100
items = podio_client.Item.filter(app_id=PODIO_APP_ID, attributes={"limit": 100})
答案 1 :(得分:0)
不是很理想,但是使用deprecated api call可以得到理想的结果……仍然想知道如何使用filter api调用来做到这一点。
params = {"limit": 300}
resp = requests.get(url="https://api.podio.com/item/app/randomappid/",
headers={'authorization': 'OAuth2 randomn0mber'},
params=params)
len(resp.json()['items'])
251