Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up a
(self, url: Optional[str]=None, certificate: Optional[Union[str, Any]]=None, max_connections: Optional[int]=None,
allowed_updates: Optional[List[str]]=None, ip_address: Optional[str]=None,
drop_pending_updates: Optional[bool] = None, timeout: Optional[int]=None, secret_token: Optional[str]=None)
| 417 | |
| 418 | |
| 419 | def set_webhook(self, url: Optional[str]=None, certificate: Optional[Union[str, Any]]=None, max_connections: Optional[int]=None, |
| 420 | allowed_updates: Optional[List[str]]=None, ip_address: Optional[str]=None, |
| 421 | drop_pending_updates: Optional[bool] = None, timeout: Optional[int]=None, secret_token: Optional[str]=None) -> bool: |
| 422 | """ |
| 423 | Use this method to specify a URL and receive incoming updates via an outgoing webhook. |
| 424 | Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, |
| 425 | containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after |
| 426 | a reasonable amount of attempts. Returns True on success. |
| 427 | |
| 428 | If you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter secret_token. |
| 429 | If specified, the request will contain a header “X-Telegram-Bot-Api-Secret-Token” with the secret token as content. |
| 430 | |
| 431 | Telegram Documentation: https://core.telegram.org/bots/api#setwebhook |
| 432 | |
| 433 | :param url: HTTPS URL to send updates to. Use an empty string to remove webhook integration, defaults to None |
| 434 | :type url: :obj:`str`, optional |
| 435 | |
| 436 | :param certificate: Upload your public key certificate so that the root certificate in use can be checked, defaults to None |
| 437 | :type certificate: :class:`str`, optional |
| 438 | |
| 439 | :param max_connections: The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. |
| 440 | Defaults to 40. Use lower values to limit the load on your bot's server, and higher values to increase your bot's throughput, |
| 441 | defaults to None |
| 442 | :type max_connections: :obj:`int`, optional |
| 443 | |
| 444 | :param allowed_updates: A JSON-serialized list of the update types you want your bot to receive. For example, |
| 445 | specify [“message”, “edited_channel_post”, “callback_query”] to only receive updates of these types. See Update |
| 446 | for a complete list of available update types. Specify an empty list to receive all update types except chat_member (default). |
| 447 | If not specified, the previous setting will be used. |
| 448 | |
| 449 | Please note that this parameter doesn't affect updates created before the call to the setWebhook, so unwanted updates may be received |
| 450 | for a short period of time. Defaults to None |
| 451 | |
| 452 | :type allowed_updates: :obj:`list`, optional |
| 453 | |
| 454 | :param ip_address: The fixed IP address which will be used to send webhook requests instead of the IP address |
| 455 | resolved through DNS, defaults to None |
| 456 | :type ip_address: :obj:`str`, optional |
| 457 | |
| 458 | :param drop_pending_updates: Pass True to drop all pending updates, defaults to None |
| 459 | :type drop_pending_updates: :obj:`bool`, optional |
| 460 | |
| 461 | :param timeout: Timeout of a request, defaults to None |
| 462 | :type timeout: :obj:`int`, optional |
| 463 | |
| 464 | :param secret_token: A secret token to be sent in a header “X-Telegram-Bot-Api-Secret-Token” in every webhook request, 1-256 characters. |
| 465 | Only characters A-Z, a-z, 0-9, _ and - are allowed. The header is useful to ensure that the request comes from a webhook set by you. Defaults to None |
| 466 | :type secret_token: :obj:`str`, optional |
| 467 | |
| 468 | :return: True on success. |
| 469 | :rtype: :obj:`bool` if the request was successful. |
| 470 | """ |
| 471 | |
| 472 | return apihelper.set_webhook( |
| 473 | self.token, url = url, certificate = certificate, max_connections = max_connections, |
| 474 | allowed_updates = allowed_updates, ip_address = ip_address, drop_pending_updates = drop_pending_updates, |
| 475 | timeout = timeout, secret_token = secret_token) |
| 476 |
no outgoing calls
no test coverage detected