mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-29 03:32:49 +01:00
parent
792ad62fe8
commit
7e7acdeb23
2 changed files with 27 additions and 28 deletions
|
@ -1182,31 +1182,27 @@ class Bot(TelegramObject):
|
||||||
return url, data
|
return url, data
|
||||||
|
|
||||||
@log
|
@log
|
||||||
def getUpdates(self, offset=None, limit=100, timeout=0, network_delay=.2, **kwargs):
|
def getUpdates(self, offset=None, limit=100, timeout=0, network_delay=5., **kwargs):
|
||||||
"""Use this method to receive incoming updates using long polling.
|
"""Use this method to receive incoming updates using long polling.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
offset:
|
offset (Optional[int]):
|
||||||
Identifier of the first update to be returned. Must be greater by
|
Identifier of the first update to be returned. Must be greater by one than the highest
|
||||||
one than the highest among the identifiers of previously received
|
among the identifiers of previously received updates. By default, updates starting with
|
||||||
updates. By default, updates starting with the earliest unconfirmed
|
the earliest unconfirmed update are returned. An update is considered confirmed as soon
|
||||||
update are returned. An update is considered confirmed as soon as
|
as getUpdates is called with an offset higher than its update_id.
|
||||||
getUpdates is called with an offset higher than its update_id.
|
limit (Optional[int]):
|
||||||
limit:
|
Limits the number of updates to be retrieved. Values between 1-100 are accepted.
|
||||||
Limits the number of updates to be retrieved. Values between 1-100
|
Defaults to 100.
|
||||||
are accepted. Defaults to 100.
|
timeout (Optional[int]):
|
||||||
timeout:
|
Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling.
|
||||||
Timeout in seconds for long polling. Defaults to 0, i.e. usual
|
network_delay (Optional[float]):
|
||||||
short polling.
|
Additional timeout in seconds to allow the response from Telegram servers. This should
|
||||||
network_delay:
|
cover network latency around the globe, SSL handshake and slowness of the Telegram
|
||||||
Additional timeout in seconds to allow the response from Telegram
|
servers (which unfortunately happens a lot recently - 2016-05-28). Defaults to 5.
|
||||||
to take some time when using long polling. Defaults to 2, which
|
|
||||||
should be enough for most connections. Increase it if it takes very
|
|
||||||
long for data to be transmitted from and to the Telegram servers.
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
list[:class:`telegram.Update`]: A list of :class:`telegram.Update`
|
list[:class:`telegram.Update`]
|
||||||
objects are returned.
|
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`telegram.TelegramError`
|
:class:`telegram.TelegramError`
|
||||||
|
|
|
@ -112,22 +112,25 @@ class Updater(object):
|
||||||
def start_polling(self,
|
def start_polling(self,
|
||||||
poll_interval=0.0,
|
poll_interval=0.0,
|
||||||
timeout=10,
|
timeout=10,
|
||||||
network_delay=2,
|
network_delay=5.,
|
||||||
clean=False,
|
clean=False,
|
||||||
bootstrap_retries=0):
|
bootstrap_retries=0):
|
||||||
"""
|
"""
|
||||||
Starts polling updates from Telegram.
|
Starts polling updates from Telegram.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
poll_interval (Optional[float]): Time to wait between polling
|
poll_interval (Optional[float]): Time to wait between polling updates from Telegram in
|
||||||
updates from Telegram in seconds. Default is 0.0
|
seconds. Default is 0.0
|
||||||
|
|
||||||
timeout (Optional[float]): Passed to Bot.getUpdates
|
timeout (Optional[float]): Passed to Bot.getUpdates
|
||||||
|
|
||||||
network_delay (Optional[float]): Passed to Bot.getUpdates
|
network_delay (Optional[float]): Passed to Bot.getUpdates
|
||||||
clean (Optional[bool]): Whether to clean any pending updates on
|
|
||||||
Telegram servers before actually starting to poll. Default is
|
clean (Optional[bool]): Whether to clean any pending updates on Telegram servers before
|
||||||
False.
|
actually starting to poll. Default is False.
|
||||||
bootstrap_retries (Optional[int[): Whether the bootstrapping phase
|
|
||||||
of the `Updater` will retry on failures on the Telegram server.
|
bootstrap_retries (Optional[int]): Whether the bootstrapping phase of the `Updater`
|
||||||
|
will retry on failures on the Telegram server.
|
||||||
|
|
||||||
| < 0 - retry indefinitely
|
| < 0 - retry indefinitely
|
||||||
| 0 - no retries (default)
|
| 0 - no retries (default)
|
||||||
|
|
Loading…
Reference in a new issue