I
I
Ilyas2018-02-14 22:49:42
Python
Ilyas, 2018-02-14 22:49:42

Why webhook telegram is not installed via celery?

Hello, I'm trying to install a webhook for a telegram bot, for this I have a task in celery.
The task is very simple: it simply makes a post request to the address https://api.telegram.org/bottoken/setWebhook, where in the request body it contains the url where to send webhooks. It would seem that there is something complicated? The request passes, telegram replies that the webhook is installed, but does not send anything, when requesting the https://api.telegram.org/bottoken/getWebhookInfo method, telegram responds like this:

{
    'ok': True, 
    'result': {
        'url': 'https://<url>/75d78ee1-835f-461b-85bc-e5a755a829d4/webhook/telegram/', 
        'has_custom_certificate': False, 
        'pending_update_count': 0, 
        'last_error_date': 1518608932, 
        'last_error_message': 'SSL error {337047686, error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed}', 
        'max_connections': 40
    }
}

well, let's say that the certificate that was received from letsencrypt is not suitable (although it has class A on the ssllabs site), but it does, because if I make the same request, from the same server, but not in the context of a task, which is performed by the cellery worker, then everything turns out and telegram sends everything to this address and there is no swearing on ssl!
Tell me, why did celery not please the telegram? I just don't have a connection in my head.
This is how I make a request to set a webhook:
data = {
    'url': 'https://<url>/75d78ee1-835f-461b-85bc-e5a755a829d4/webhook/telegram/',
}

requests.post('https://api.telegram.org/bottoken/setWebhook', json=data)

PS:
Here is the answer after the request without celery:
{
    'ok': True, 
    'result': {
        'url': 'https://<url>/75d78ee1-835f-461b-85bc-e5a755a829d4/webhook/telegram/', 
        'has_custom_certificate': False, 
        'pending_update_count': 0, 
        'max_connections': 40
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Burlakov, 2018-10-26
@redflasher

  1. Test your site at https://www.ssllabs.com
    If you are using a certificate from letsencrypt, then there are 2 files with the certificate:
    I (I use nginx+php, but the essence does not change) had cert.pem and had the same error. Switched to fullchain.pem and the error disappeared.
    Well and plus additional settings of the server specified. If the above steps do not help and you want to figure it out together - write, we'll try to figure it out ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question