Python脚本获取比特币价格并通过短信发送

时间:2018-08-20 15:13:00

标签: python-3.x twilio-api

伙计们,我正在尝试获取比特币价格并通过短信发送至我的电话号码。请告诉我每10分钟如何通过短信发送结果。我正在使用twilio API。

import requests
from apscheduler.schedulers.blocking import BlockingScheduler

def btc():
    r=requests.get('https://api.coindesk.com/v1/bpi/currentprice.json')
    btc= r.json()['bpi']['USD']['rate']
    print('The Current Bitcoin Price: ' + btc + ' Usd')

scheduler = BlockingScheduler()
scheduler.add_job(btc, 'interval', seconds = 3)
scheduler.start()

0 个答案:

没有答案