0

I am using python to pull log using the API curl command.

curl -H "Authorization:Token xxxxxxxx-xxxx-xxxxx" -XGET https://my-api.holmsecurity.com/v2/net-scans

I want to filter this curl output say 'past 24 hours'.

The API supports ISO 8601 format (e.g. 2022-03-01T10:00:00Z), also with UTC offsets (e.g. 2022-03-01T11:00:00+0100)

Thank you.

3
  • Can you give a snippet of what the request gives back to you? Does it give you an array of times for logs or a JSON?
    – qBen_Plays
    Commented May 22, 2020 at 12:48
  • {"count":1,"next":null,"previous":null,"results":[{"status":"completed","name":"test","progress_percent":0,"uuid":"xxxxxxxxxxxxxxxx","vulnerabilities_count":1290,"started_date":"2020-05-18T21:43:41Z","finished_date":"2020-05-19T01:42:16Z","target_assets":[{"name":"testseceon","type":"network","uuid":"xxxxxxxxxxxx"}]}]}
    – Ajay Gupta
    Commented May 22, 2020 at 14:28
  • I want to filter if finish date is greater that say 2020-05-20T02:42:16Z
    – Ajay Gupta
    Commented May 22, 2020 at 14:29

1 Answer 1

0

You have to use requests package of python.
A typical example is like this:

# 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)
1
  • His actual question was how he would we able to filter the data based on the datetime in the first place.
    – qBen_Plays
    Commented May 22, 2020 at 15:58

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.