F
F
fizique2016-11-20 23:26:22
Python
fizique, 2016-11-20 23:26:22

How to make a request to OK API?

There is a code:

API_SERVER = 'https://api.ok.ru/'

sig = hashlib.md5(('friends.get' + conf.SECRET_SESSION_KEY).encode('utf8')).hexdigest()
api_request = '{}?access_token={}&method={}&application_id={}&sig={}'\
    .format(API_SERVER, conf.ACCESS_TOKEN, 'friends.get', conf.APP_ID, sig)
res = requests.get(api_request).text
print(res)

ACCESS_TOKEN and SECRET_SESSION_KEY obtained in the application settings panel in order to make requests without authorization, only on behalf of the developer.
As a result of this request, I get:
Forticom API Server
What is this answer and what am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vjacheslav Kanivetc, 2016-11-21
@fizique

We read the documentation more carefully.. Either use the api.ok.ru/fb.do wrapper, or call methods from api.ok.ru/api/...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question