pythonpython-requeststelegram-botsendfile

send txt file in telegam via request website to telegram bot


I want to send a file using a request website(https://www.httpdebugger.com/tools/ViewHttpHeaders.aspx) and a bot in telegram for example this code is for sending a massage in roobt :

TEXT = input('please enter your text : ')
url = (f'https://api.telegram.org/bot{apiToken}/sendmessage?chat_id={chatID}&text={TEXT}')
payload = {"UrlBox":url,
        "AgentList":"Mozilla Firefox",
        "VersionsList":"HTTP/1.1",
        "MethodList":"POST"
    }
req = requests.post("https://www.httpdebugger.com/tools/ViewHttpHeaders.aspx" , data=payload)
print(req)

but i don't know how to send files with this website i want to do this all because telegram is not working in our country and we have to use a vpn or third-party websites.

I tried chatgpt and searching in telegram documents I found some guy named m7.arman (user:14770721) answered my question worng and it wasn't helpful it is true and it works but it won't send file via https://www.httpdebugger.com/tools/ViewHttpHeaders.aspx


Solution

  • It's simply not possible to send files using that website.

    Sending files using the sendDocument method requires passing the file as multipart/form-data, however, httpdebugger.com does not provide an optie to pass files as form-data for a POST request.

    You'll need a proxy or an other website to send files to Telegram.