Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. async def audio_api(method, query, count):
  2.     API_URL = "https://api.vk.com/method/"
  3.     TOKEN = ""
  4.     headers = {
  5.             "Host":"api.vk.com",
  6.             "User-Agent": ("KateMobileAndroid/45 lite-421 (Android 5.0; SDK 21; armeabi-v7a; LENOVO Lenovo A1000; ru)")
  7.     }
  8.     async with aiohttp.ClientSession() as sess:
  9.         async with sess.get(API_URL + str(method) + f"?q={query}&count={count}&access_token={TOKEN}&v=5.78", headers=headers) as resp:
  10.             response = await resp.read()
  11.             if not response:
  12.                 return None
  13.             return json.loads(response)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement