4

I try to build a Telegram bot using python and Telegram Bot API and since Telegram Bot API is censored in my country I found [this][1] script to bypass it by an app deployed using Google Apps Script. but the problem is that it just sends text and not files, so I would like the web app to sort of redirect the files I'm sending to it to Telegram, This is a part of my python code:

fr = open("result.txt", "rb")
files = {"document": fr}
script_url = 'https://script.google.com/macros/s/AKfycby20pnglgWTp4oV0tDTKuU87XmvkS6EZd-LTuoCmMM3Ge7PbGJ/exec?bot_token=' + token + '&method=sendDocument&args={"chat_id": ' + chat_id + '}'
requests.post(
    url=script_url,
    files=files
)

so I'm using a post method to send the file to the web app but on the web app side I don't know how to grab that file and send it to Telegram. [1]: https://gist.github.com/manzoorwanijk/ee9ed032caedf2bb0c83dea73bc9a28e

Marios
  • 26,333
  • 8
  • 32
  • 52

1 Answers1

1

it's a better idea to just use a proxy to bypass censorship.

if you are using python-telegram-bot then you can use this code below:

#put HTTP proxy url here
REQUEST_KWARGS = {'proxy_url': 'http://localhost:62612/'}

updater = Updater(token=TOKEN, use_context=True, request_kwargs=REQUEST_KWARGS)

you can use free tools like lantern or tor to setup your own proxy.