Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions examples/bot_longpoll.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ def main():
print(event.obj.from_id)

print('Текст:', event.obj.text)
print()

elif event.type == VkBotEventType.MESSAGE_REPLY:
print('Новое сообщение:')

Expand All @@ -33,8 +31,6 @@ def main():
print(event.obj.peer_id)

print('Текст:', event.obj.text)
print()

elif event.type == VkBotEventType.MESSAGE_TYPING_STATE:
print('Печатает ', end='')

Expand All @@ -43,23 +39,18 @@ def main():
print('для ', end='')

print(event.obj.to_id)
print()

elif event.type == VkBotEventType.GROUP_JOIN:
print(event.obj.user_id, end=' ')

print('Вступил в группу!')
print()

elif event.type == VkBotEventType.GROUP_LEAVE:
print(event.obj.user_id, end=' ')

print('Покинул группу!')
print()

else:
print(event.type)
print()

print()


if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion examples/get_album_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def main():
tracks = vkaudio.get(album_id=albums[0]['id'])

for n, track in enumerate(tracks, 1):
print('{}. {} {}'.format(n, track['title'], track['url']))
print(f"{n}. {track['title']} {track['url']}")


if __name__ == '__main__':
Expand Down
6 changes: 3 additions & 3 deletions examples/get_all_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ def main():
# Составляем рейтинг первых 15
print('Top 15:')
for artist, tracks in artists.most_common(15):
print('{} - {} tracks'.format(artist, tracks))
print(f'{artist} - {tracks} tracks')

# Ищем треки самого популярного
most_common_artist = artists.most_common(1)[0][0]

print('\nSearching for {}:'.format(most_common_artist))
print(f'\nSearching for {most_common_artist}:')

tracks = vkaudio.search(q=most_common_artist, count=10)

for n, track in enumerate(tracks, 1):
print('{}. {} {}'.format(n, track['title'], track['url']))
print(f"{n}. {track['title']} {track['url']}")


if __name__ == '__main__':
Expand Down
6 changes: 2 additions & 4 deletions examples/messages_bot/user_messages_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def main():

for event in longpoll.listen():
if event.type == VkEventType.MESSAGE_NEW and event.to_me and event.text:
print('id{}: "{}"'.format(event.user_id, event.text), end=' ')
print(f'id{event.user_id}: "{event.text}"', end=' ')

response = session.get(
'http://api.duckduckgo.com/',
Expand Down Expand Up @@ -64,9 +64,7 @@ def main():
image = session.get(image_url, stream=True)
photo = upload.photo_messages(photos=image.raw)[0]

attachments.append(
'photo{}_{}'.format(photo['owner_id'], photo['id'])
)
attachments.append(f"photo{photo['owner_id']}_{photo['id']}")

vk.messages.send(
user_id=event.user_id,
Expand Down
2 changes: 1 addition & 1 deletion examples/requests_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@ def main():


if __name__ == '__main__':
main()
main()
4 changes: 1 addition & 3 deletions examples/upload_photo.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ def main():
group_id=74030368
)

vk_photo_url = 'https://vk.com/photo{}_{}'.format(
photo[0]['owner_id'], photo[0]['id']
)
vk_photo_url = f"https://vk.com/photo{photo[0]['owner_id']}_{photo[0]['id']}"

print(photo, '\nLink: ', vk_photo_url)

Expand Down
12 changes: 2 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,23 @@
setup(
name='vk_api',
version=version,

author='python273',
author_email='vk_api@python273.pw',

description=(
'Python модуль для создания скриптов для социальной сети '
'Вконтакте (vk.com API wrapper)'
),
long_description=long_description,
long_description_content_type='text/markdown',

url='https://github.com/python273/vk_api',
download_url='https://github.com/python273/vk_api/archive/v{}.zip'.format(
version
),

download_url=f'https://github.com/python273/vk_api/archive/v{version}.zip',
license='Apache License, Version 2.0, see LICENSE file',

packages=['vk_api', 'jconfig'],
install_requires=['requests'],
extras_require={
'vkstreaming': ['websocket-client'],
'vkaudio': ['beautifulsoup4'],
},

classifiers=[
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
Expand All @@ -54,5 +46,5 @@
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
]
],
)
Loading