# coding:UTF-8
import requests
import time
def get_exchange():
list = []
for i in range(1,3):
Bi_API = "https://dncapi.bqrank.net/api/v2/exchange/web-exchange?token=&page=%i&pagesize=60&sort_type=exrank&asc=1&isinnovation=1&type=all&area=&webp=0" % i
http_data = requests.get(url=Bi_API).json()
data = http_data['data']
for data_01 in data:
list.append(data_01['name'])
return list
def try_exchange():
while True:
exchange_01 = get_exchange()
time.sleep(10)
exchange_02 = get_exchange()
if exchange_02 !=exchange_01:
b = [y for y in exchange_02 if y not in exchange_01]
if b!=[]:
server_api = "https://sc.ftqq.com/xxxxxxxxx.send?" \
"text='排名发生了变化'&desp=%s" % b
requests.get(url=server_api)
def main():
try_exchange()
if __name__=='__main__':
main()