At the moment, I am trying to compare the timestamp from an API that is in yyyy-mm-ddThh:mm:ss.000Z and the current time stamp. In theory, my code should get all of these content from the responses during a certain time period, but i'm jsut confuse dabout line
14.
def retrieve_messages(auth, channelid, sec):
now = datetime.datetime.now()
format_iso_now = now.isoformat()
headers = {
'authorization': auth
}
t_end = time.time() + sec
while time.time() < t_end:
r = requests.get(f'REDACTED', headers=headers)
jsonn = json.loads(r.text)
for value in jsonn:
if value['timestamp'] <= format_iso_now:
print(value['content'], '\n')
I redacted out the API link for my own well being, but it responds with a timestamp such as "2022-04-05T06:12:53.267000+00:00". How would I complete this function to reach my goal? Thank you.