Created
March 26, 2021 12:36
-
-
Save ahvahsky2008/efa2f93a394c11ee4d9169806e9dfcd6 to your computer and use it in GitHub Desktop.
python send file with requests
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
def send_request (doc): | |
with open(doc, 'rb') as file: | |
post_data = {'chat_id': chat_id} | |
post_file = {'document': file} | |
r = requests.post(f'https://api.telegram.org/bot{token}/sendDocument', data=post_data, files=post_file) | |
print(r.text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment