我正在使用python通过API curl命令提取日志。
curl -H "Authorization:Token xxxxxxxx-xxxx-xxxxx" -XGET https://my-api.holmsecurity.com/v2/net-scans
我想过滤此卷曲输出,例如“过去24小时”。
API支持ISO 8601格式(例如2022-03-01T10:00:00Z),也具有UTC偏移量(例如2022-03-01T11:00:00 + 0100)
谢谢。
您必须使用python的请求包。一个典型的例子是这样的:
# importing the requests library
import requests
# api-endpoint
URL = "https://my-api.holmsecurity.com/v2/net-scans"
header = {'Authorization': 'Token xxxxxxxx-xxxx-xxxxx'}
# sending get request and saving the response as response object
r = requests.get(url = URL, headers = header)
# extracting data in json format
data = r.json()
//Now you can filter your data
print(data)