Python 请求-分页后?

Python 请求-分页后?,python,api,pagination,python-requests,Python,Api,Pagination,Python Requests,我想获得这些交易: 第一页没有问题: import requests headers = { 'Content-Type': 'application/x-www-form-urlencoded', } data = [('addr', '1FoWyxwPXuj4C6abqwhjDWdz6D4PZgYRjA')] response = requests.post('https://api.omniexplorer.info/v1/address/addr/details/', h

我想获得这些交易:

第一页没有问题:

import requests

headers = {
    'Content-Type': 'application/x-www-form-urlencoded',
}

data = [('addr', '1FoWyxwPXuj4C6abqwhjDWdz6D4PZgYRjA')]

response = requests.post('https://api.omniexplorer.info/v1/address/addr/details/', headers=headers, data=data)

response = response.json()

print(response["transactions"])
但我怎么能调用第2页为例

我试过使用params“params={'page':2}”,但不起作用

非常感谢您的帮助


关于

你应该认为它可能很安静,然后你就会知道怎么做了

import requests

headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
}
pj = {}

for page in range(1,3):
    data = [('addr', '1FoWyxwPXuj4C6abqwhjDWdz6D4PZgYRjA'),('page',page)]
    response = requests.post('https://api.omniexplorer.info/v1/address/addr/details/', headers=headers , data = data)
    response = response.json()
    print(response)
    pj[page] = response["transactions"]
value = list(pj.values())
print(value[0] == value[1])

对于正在使用的API,应将页码作为表单值发送:

curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "page=19" "https://api.omniexplorer.info/v1/properties/gethistory/3"
如果将page=19替换为page=20,您将看到第二个调用只有三个条目,而第一个调用有十个条目

使用请求时,应该是这样的:

r = requests.post('https://api.omniexplorer.info/v1/properties/gethistory/3',
                  data={'page': 10})
或者,使用您自己的示例,而不是我在他们的页面上找到的示例:

import requests

headers = {
    'Content-Type': 'application/x-www-form-urlencoded',
}

data = {
    'addr': '1FoWyxwPXuj4C6abqwhjDWdz6D4PZgYRjA',
    'page': 1,
}

response = requests.post('https://api.omniexplorer.info/v1/address/addr/details/',
                         headers=headers, data=data)

这取决于服务器实现。查看当您请求浏览器中的第二个页面时,浏览器会做什么。它会添加一个带有页码的/(例如/2),因为我试图通过api获取数据,如何通过请求实现这一点?将
/2
添加到
'https://api.omniexplorer.info/v1/address/addr/details/“
,如果浏览器就是这样做的,那么是否有关于API的文档?如果它是一个不错的API,那么应该有一种方法返回请求的记录总数。然后,您应该能够使用此计数以及“offset”参数对记录进行分页。有时,他们甚至会在响应中提供一个URL,您可以使用它来请求下一组记录。thx BigGerman-有一个文档()并且记录的总数是可用的(响应[“页面])-但是我还没有找到设置偏移参数的方法,但我会进一步查看,感谢您的指导!总而言之,这取决于我的经验,而不是试图理解api文档。我并没有在文档中看到关于如何访问下一页的任何细节