*** In the case of next is not a page number that is similar to the page ***
-
Shoot the URL, get data back 1000 at a time, which is data 1-1000 (api url is limited to 1000)
-
If you add Parameter next to the URL, you get 1000 but it starts at 1001 (data at 1001-2000 can loop 1000 as well)
-
Ask for an example method for loop parameter next (not page =1,2,3).
-
code python
import requests
import json
url = "https://api.xxx.com/"
api_key ="test"
user = "abc@test.co.th"
headers = {
"Content-Type": "application/json",
"Authorization": "apikey " + user + ":" + api_key
}
response = requests.get(url, verify=False, headers=headers)
data = response.json()
print(json.dumps(data, indent=4))
if (response.status_code == 200):
print("status_code = " + str(response.status_code) + " The request was a success!")
elif (response.status_code == 404):
print("status_code = " + str(response.status_code) + " Result not found!")
- The response code is quite large, I tried to show the code in the meta.
"meta": {
"total_count": 2234,
"offset": 0,
"limit": 1000,
"took": 138,
"next": "/api/v2/intelligence/?q=%28%28status%3D%27active%27%29+and+%28confidence%3E%3D90%29+and+%28country%3D%27TH%27%29%29&search_after=1628780720222%2C57395475643&limit=1000"
}