An error 404 but all conf.py data are matching

please help me out these are my codes with output out

conf

Try using the POST method instead of the GET method. Also use https protocol for Telegram url and not http.
Please remove the screenshots with your private API keys.
Also, as a precaution, reset your API keys if possible.

1 Like

Can you please elaborate the method

Hi @push1970

You are sending the request to telegram using GET method. You need to send data your data using POST method.

Your current code in send_telegram_message function -

response = requests.request(
            "GET",
            url,
            params=data
        )

Correct code in send_telegram_message function -

response = requests.request(
            "POST",
            url,
            params=data
        )

To know more about GET and POST refer this link https://www.w3schools.com/tags/ref_httpmethods.asp

Do let me know in case you need any other information.


no still same

hey just restart you device and try again because in my case also i tried 5 time then also there was error 404 was there but after restart several time it works ,and see if you have some code error :slight_smile:

no bro still i am getting same error i dont knew why someone please help me i am stuck for 2 days

i have posted all my details which can help me out so,please help me

@push1970 You have entered an incorrect URL for telegram. The URL entered by you is,
"https://api.telegram.org/" + conf.telegram_bot_id + "/send message"
whereas the correct URL is,
"https://api.telegram.org/" + conf.telegram_bot_id + "/sendMessage"

Also, the request is supposed to be a POST method. Please make the change in the method and the URL and it should work.
Add the print statement after you have defined the URL to make sure that the URL is correct.

2 Likes

yes its working thank you sir sol
:+1:

1 Like