-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
executable file
·38 lines (29 loc) · 977 Bytes
/
run.py
File metadata and controls
executable file
·38 lines (29 loc) · 977 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import config
import requests
def run():
r = requests.get(config.url, headers=config.headers)
result = r.json()
stores = result['stores']
for store_key in config.stores:
if store_key in stores:
data = stores[store_key]
#data['MLE63CH/A'] = {'availability': {'contract': False, 'unlocked': True}}
for key in data:
if data[key]['availability']['unlocked'] and key in config.iPhones:
store_name = config.stores[store_key]
name = config.iPhones[key]
message = '[ALERT] {} {}店铺有货!'.format(name, store_name)
ding(message)
def ding(message):
'''发送钉钉通知'''
params = {
"msgtype": "text",
"text": {
"content": message,
},
}
requests.post(config.dingtalk, json=params)
if __name__ == "__main__":
run()