This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import os | |
r = requests.get("https://images.unsplash.com/photo-1452857576997-f0f12cd77844?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2850&q=80") | |
with open("photo.jpg", "wb") as f: | |
f.write(r.content) | |
requests.post( | |
"https://api.telegram.org/bot<TOKEN>/sendPhoto?chat_id=<chat_id>", | |
files={"photo": open("photo.jpg", "rb")} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import io | |
r = requests.get("https://images.unsplash.com/photo-1452857576997-f0f12cd77844?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2850&q=80") | |
with io.BytesIO() as buf: | |
buf.write(r.content) | |
buf.seek(0) | |
requests.post( | |
"https://api.telegram.org/bot<TOKEN>/sendPhoto?chat_id=<chat_id>", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INFURA_URL_TESTNET=<your_url_and_key> |