<reponame>BehindLoader/syom_kak_ty
"""VK API calls module."""

from requests import get

API_BASE_URL = 'https://api.vk.com/method/{0}?{1}'


def options_to_args(options):
    """Parse options to param string."""
    query_params = []
    for key in options:
        query_params.append(
            '{0}={1}'.format(key, options[key]),
        )
    return '&'.join(query_params)


def call_api(method, options):
    """Call VK API method and handle it."""
    options['v'] = '5.52'
    query_params = options_to_args(options)
    formatted_url = API_BASE_URL.format(method, query_params)
    request_data = get(formatted_url)
    return request_data.json()

"""VK API calls module."""

from requests import get

API_BASE_URL = 'https://api.vk.com/method/{0}?{1}'


def options_to_args(options):
    """Parse options to param string."""
    query_params = []
    for key in options:
        query_params.append(
            '{0}={1}'.format(key, options[key]),
        )
    return '&'.join(query_params)


def call_api(method, options):
    """Call VK API method and handle it."""
    options['v'] = '5.52'
    query_params = options_to_args(options)
    formatted_url = API_BASE_URL.format(method, query_params)
    request_data = get(formatted_url)
    return request_data.json()
VK API calls module. Parse options to param string. Call VK API method and handle it.