Skip to content

Commit

Permalink
update docs and rename LongPoll to UserLongPoll
Browse files Browse the repository at this point in the history
  • Loading branch information
Fahreeve committed Jul 15, 2018
1 parent f6aa092 commit e764855
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ Supports both variants like API object

Long Poll
---------
**UserLongPoll** - for User Long Poll API. See https://vk.com/dev/using_longpoll

**BotsLongPoll** - for Bots Long Poll API. See https://vk.com/dev/bots_longpoll

Use exist API object

.. code-block:: python
Expand Down
10 changes: 9 additions & 1 deletion aiovk/longpoll.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ async def get_pts(self, need_ts=False):
return self.pts


class LongPoll(BaseLongPoll):
class UserLongPoll(BaseLongPoll):
"""Implements https://vk.com/dev/using_longpoll"""

async def _get_long_poll_server(self, need_pts=False):
response = await self.api('messages.getLongPollServer', need_pts=int(need_pts), timeout=self.timeout)
self.pts = response.get('pts')
Expand All @@ -107,6 +108,13 @@ async def _get_long_poll_server(self, need_pts=False):
# fucking differences between long poll methods in vk api!
self.base_url = 'https://{}'.format(response['server'])


class LongPoll(UserLongPoll):
"""Implements https://vk.com/dev/using_longpoll
This class for backward compatibility
"""


class BotsLongPoll(BaseLongPoll):
"""Implements https://vk.com/dev/bots_longpoll"""
Expand Down

0 comments on commit e764855

Please sign in to comment.