This is the actual code:
import requests
import json
from datetime import datetime
partner_tkn = 'xxx'
merchant_tkn = 'xxx'
now = datetime.now()
output = ]
def get_orders():
r_orders = requests.get(f'https://api.myonlinestore.com/v1/orders?language=nl_NL&limit=10&format=json&ordering=asc&partner_token={partner_tkn}&token={merchant_tkn}')
orders = json.loads(r_orders.text)
for order in orders:
date_time_string = orderr'date']+'T'+orderr'time']
date_time = datetime.strptime(date_time_string,'%Y-%m-%dT%H:%M:%S')
hours = (now-date_time).total_seconds()/3600
if hours <= 2.5:
print(order)
output.append(order)
get_orders()