Skip to content

Instantly share code, notes, and snippets.

@skar404
Last active May 15, 2017 09:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skar404/807e5fee2a01c37740a99c2b5492a18d to your computer and use it in GitHub Desktop.
Save skar404/807e5fee2a01c37740a99c2b5492a18d to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
import vk_api
def main():
login, password = 'user@user.ru', '12345678'
vk_session = vk_api.VkApi(login, password)
try:
vk_session.authorization()
except vk_api.AuthorizationError as error_msg:
print(error_msg)
return
vk = vk_session.get_api()
response = vk.friends.get(fields='sex')
if response['items']:
for i in response['items']:
if i['sex'] == 1:
vk.messages.send(user_id=i['id'], message='С 23 февраля, это Дэн')
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment