Untitled

 avatar
unknown
plain_text
2 years ago
539 B
5
Indexable
import requests
from win10toast import ToastNotifier
import time

def get_bitcoin_price():
    url = "https://min-api.cryptocompare.com/data/price?fsym=BTC&tsyms=USD"
    response = requests.get(url)
    data = response.json()
    price = data["USD"]
    return price

def show_notification(message):
    toaster = ToastNotifier()
    toaster.show_toast("Bitcoin Price", message, duration=10)


bitcoin_price = get_bitcoin_price()
message = f"The current price of Bitcoin is: {bitcoin_price} USD"
print(message)
show_notification(message)
Editor is loading...