Last active
November 22, 2021 13:58
-
-
Save istudyatuni/e248ea77cc9ee90da8b74aed93dda9b8 to your computer and use it in GitHub Desktop.
Track changing boxberry status without needing reload page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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