Skip to main content

vk.com Python REST API wrapper

Project description

vk.com Python REST API wrapper

About

This is a vk.com (Russian social network) python API wrapper. The goal is to support all API methods: https://vk.com/dev/methods.

Getting Started

Install package using pip

pip install aiovkcom

To use VK API you need a registered app and login account in the social network.

  1. Sign up in vk.com
  2. Create standalone application.
  3. Save App ID.
  4. Use App ID, list of required permissions and user credentials to get access token.
  5. Use the access token to make method requests.

After signing up go to https://vk.com/dev/standalone and create application.

app_id = 'your App ID'

ImplicitSession

You can authenticate with VK API OAuth2 by passing user credentials and permissions to ImplicitSession.

from aiovkcom import ImplicitSession
from aiovkcom.permissions import bit_scope, PERMISSIONS

phone = '+1999123456'
password = 'user password'

session = await ImplicitSession(
    app_id=app_id,
    login=phone,  # set phone number or e-mail as login
    passwd=password,
    scope=bit_scope(PERMISSIONS),  # get all possible permissions
    v='5.101',  # set version for all requests
)

List of all permissions is available here: https://vk.com/dev/permissions.

Now you can execute API requests (see Executing API requests). After authentication you will get access token session.access_token. Save it to make requests later:

access_token = session.access_token

TokenSession

If you already have an access token you can instantiate TokenSession

from aiovkcom import TokenSession

session = TokenSession(access_token, v='5.101')

and execute requests.

Executing API requests

List of all methods is available here: https://vk.com/dev/methods.

from aiovkcom import API

api = API(session)

# current user's friends
friends = await api.friends.get()

# current user's groups
groups = await api.groups.get()

List of objects is available here: https://vk.com/dev/objects

License

aiovkcom is released under the BSD 2-Clause License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiovkcom-0.0.3.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

aiovkcom-0.0.3-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file aiovkcom-0.0.3.tar.gz.

File metadata

  • Download URL: aiovkcom-0.0.3.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.2

File hashes

Hashes for aiovkcom-0.0.3.tar.gz
Algorithm Hash digest
SHA256 84d8308563d2798430f1d48aad0bcc28990f24f4f08e7eeabf020c2c994e4773
MD5 ef3849fb83b3d1d7af20e4137155e069
BLAKE2b-256 bf1a2a35cbb7e23c8003bf2fda6805c7a45199f567f180d86e3bf5378fa2c532

See more details on using hashes here.

File details

Details for the file aiovkcom-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: aiovkcom-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.2

File hashes

Hashes for aiovkcom-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 769e939742f5fa8f1febecd4d3d7e037a28985f7cd2a487ea78a64ab91b7cc36
MD5 27e78806d6c42613b262df66bc14b4a1
BLAKE2b-256 a5f2b0b77fcb430c12bb7cbab9b4dd8bc0a50b220d7a3037243e7925504e41f9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page