try:
import urequests as requests
except ModuleNotFoundError:
import requests
TOKEN = "5657838543:AAHymAWHrzZ1fBOA-VrKik0jJAUfTky5K1I"
URL = f"https://api.telegram.org/bot{TOKEN}/"
CHAT_ID = "5066659725"
def send_message(text, chat_id):
url = f"{URL}sendMessage?text={text}&chat_id={chat_id}"
response = requests.get(url)
content = response.text
return content
import urequests
import network, time
ssid='AFFAN'
password='66666666'
# Configure ESP as Station using SSID-Password wifi
sta_if=network.WLAN(network.STA_IF)
sta_if.active(True)
if not sta_if.isconnected():
print('connecting to network...')
sta_if.connect(ssid, password)
while not sta_if.isconnected():
pass
print('network config:', sta_if.ifconfig())
TOKEN = "5657838543:AAHymAWHrzZ1fBOA-VrKik0jJAUfTky5K1I"
URL = f"https://api.telegram.org/bot{TOKEN}/"
CHAT_ID = "5066659725"
def send_message(text, chat_id):
url = f"{URL}sendMessage?text={text}&chat_id={chat_id}"
response = urequests.get(url)
#response = requests.get(url)
content = response.text
response.close()
return content
send_message("Hello guys!", CHAT_ID)
#if __name__ == '__main__':
#print(send_message("Your parcel arrived", CHAT_ID))