2022-05-27 16:41:34 +02:00
|
|
|
#!/usr/bin/env python3
|
2019-12-15 13:37:26 +01:00
|
|
|
|
2022-05-27 16:41:34 +02:00
|
|
|
import requests, json, time
|
|
|
|
from downloader import Downloader
|
2019-12-15 13:37:26 +01:00
|
|
|
|
2022-05-27 16:41:34 +02:00
|
|
|
class Lightify(Downloader):
|
2019-12-15 13:37:26 +01:00
|
|
|
|
2022-10-04 00:01:06 +02:00
|
|
|
def get_url_list(self):
|
2022-05-27 16:41:34 +02:00
|
|
|
response = requests.get("https://api.update.ledvance.com/v1/zigbee/products")
|
|
|
|
if 'Retry-After' in response.headers:
|
|
|
|
defer = int(response.headers['Retry-After']) + 1
|
|
|
|
print(f"Waiting {defer} seconds to get ledvance list")
|
|
|
|
time.sleep(defer)
|
|
|
|
response = requests.get("https://api.update.ledvance.com/v1/zigbee/products")
|
2019-12-15 13:37:26 +01:00
|
|
|
|
2022-05-27 16:41:34 +02:00
|
|
|
response = json.loads(response.content)
|
|
|
|
|
|
|
|
productlist = response['products']
|
|
|
|
res = []
|
|
|
|
for x in productlist:
|
|
|
|
company = x.get('id').get('company')
|
|
|
|
product = x.get('id').get('product')
|
|
|
|
res.append(('https://api.update.ledvance.com/v1/zigbee/firmwares/download/%s/%s/latest' % (company, product), None))
|
|
|
|
|
|
|
|
return res
|