dimanche 29 octobre 2017

Telegram Bot - Bad Request: wrong file identifier/HTTP URL specified

I have a weird problem with uploading a file to telegram via the sendDocument method. I am writing a bot in python with python-telegram-bot. I try to send a ZIP file to a user, giving a URL as document. This is the URL: http://ift.tt/2zZ4KNC

bot.send_document(
    chat_id,
    document=document,
    filename=filename,
    timeout=60)

As much as I know my file follows the rules given by Telegram: http://ift.tt/2zZ4KNC

  • Provide Telegram with an HTTP URL
    • http://ift.tt/2zZ4KNC
  • 20 MB max
    • 2.14 MB
  • correct MIME type
    • application/zip
  • sending by URL will currently only work for gif, pdf and zip files
    • ZIP file

These are the headers:

Accept-Ranges →bytes
Connection →keep-alive
Content-Length →2247049
Content-Type →application/zip
Date →Sun, 29 Oct 2017 21:15:36 GMT
ETag →"59f5e6e6-224989"
Last-Modified →Sun, 29 Oct 2017 14:34:14 GMT
Server →nginx/1.10.3 (Ubuntu)

The file is served by nginx (v1.10.3), with this simple configuration.

server {
    listen 80;
    server_name telegram.nickespig.ch;

    root /path/to/download_dir;
    location / {
        try_files $uri $uri/ =404;
    }
}

Where /path/to/download_dir is replaced with the actual path of course.

The error I get, as said in the title, is this one:

{
    "ok": false,
    "error_code": 400,
    "description": "Bad Request: wrong file identifier/HTTP URL specified"
}

Also sending another ZIP file which I found online works: http://ift.tt/2xwTVAE

I already searched for a solution and eg. this Telegram bot weird error : Bad Request: wrong file identifier/HTTP URL specified and this Why i get Wrong file identifier/HTTP URL specified error in telegram bot? do not help.

I hope you guys can help me with this.




Aucun commentaire:

Enregistrer un commentaire