Skip to content

Instantly share code, notes, and snippets.

@istudyatuni
Last active November 22, 2021 13:58
Show Gist options
  • Save istudyatuni/e248ea77cc9ee90da8b74aed93dda9b8 to your computer and use it in GitHub Desktop.
Save istudyatuni/e248ea77cc9ee90da8b74aed93dda9b8 to your computer and use it in GitHub Desktop.
Track changing boxberry status without needing reload page
import os
import requests
import time
sid = ''
url = f'https://boxberry.ru/api/v1/tracking/order/get?searchId={sid}'
headers = {
'user-agent': 'Mozilla/5.0'
}
last_date = None
i = 1
while True:
print('request', i, end='\r')
response = requests.get(url, headers=headers)
data = response.json()[0]
date = data['lastUpdateDate']
if date != last_date and last_date:
os.system('date')
print('\nStatus changed')
last_date = date
time.sleep(60)
i += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment