G
G
GeekFromUa2014-10-17 19:40:25
Python
GeekFromUa, 2014-10-17 19:40:25

Why can't I log in VK from the server?

I'm trying to log in to VKontakte (in the Standalone application) using the Python vk library via the sh console.
d767f91a394d4c1c83af32dada6eaddc

Answer the question

In order to leave comments, you need to log in

3 answer(s)
G
GeekFromUa, 2014-10-18
@petriychuk

Sorry, I'm learning....
Get a token:
https://oauth.vk.com/authorize?client_id=12343547&...
Well, log in:

import vk
vkapi = vk.API(access_token='access_token')

Everything worked on the local machine, the received token is bound to IP

A
alternativshik, 2014-10-18
@alternativshik

I haven't seen anything like this yet, that they posted the text of errors with a screenshot of a piece of the screen ...
Post the full trace and your code, telepaths are on vacation!

I
Ilya, 2014-10-19
@FireGM

The token is not bound to an IP. A token is a token, simply for authorizing an application that is currently running.
Here, for example, is my code for automatically uploading YouTube videos to a group.

vkapi = vk.API(access_token='здесь_токен')


def upload_video_vk(url, title, description):
    """Функция добавления видео с youtube(без загрузки)
       на стену группы."""
    # Добавляем видео в группу, но загрузка ещё не произошла
    video1 = vkapi.video.save(group_id='77097637', link=url, wallpost=1, name=title, 
                    description=description)
    # Видео еще не загрузилось, оно только приготовилось, 
    # а для загрузки надо открыть урл из video.
    urllib.urlopen(video1['upload_url'])
    attach = 'video%s_%s' % (video1['owner_id'], video1['video_id'])
    # Публикуем видео на стене группы(from_group=1)
    post_group = vkapi.wall.post(owner_id='здесь_ID_группы_с минусом_впереди',
              from_group=1, message=description, attachments=attach)
    # И возвращает ID поста
    return post_group['post_id']

# Теперь загрузим
video_description="Описание"
video_title = 'Название'
video_url = 'ссылка на видео на ютубе'
video_on_vk = upload_video_vk(video_url, video_title, video_description)

This is just an example. I take all the information from the database of the site.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question