pythonpython-3.xvk

Get username with helping user id vk_api


I use python 3 and vk_api How can I get user name and surname if i have only his vk id, using python and vk_api?

This method doesn't work: I want get similar information about other user, this method returns information about current user(user).

info = user.account.getInfo()

Have vk_api function that gets the user id and returns information about it? How can I get user name and surname having only his id, from a python script? Thanks for any help.


Solution

  • user = vk.users.get(user_id='456**665')
    

    Returns a set with lists containing information about the specified users(users_id can be passed as a comma-separated string containing the identifiers of the required users)