prawn-cake / vk-requests

vk.com requests for humans. API library for vk.com
MIT License
158 stars 22 forks source link

Access denied #1

Closed hograthm closed 8 years ago

hograthm commented 8 years ago
2016-01-17 01:50:35,221 INFO [vk-requests] Getting access token for user '+somenumber'
2016-01-17 01:50:35,229 INFO [requests.packages.urllib3.connectionpool] Starting new HTTPS connection (1): m.vk.com
2016-01-17 01:50:35,457 INFO [requests.packages.urllib3.connectionpool] Starting new HTTPS connection (1): login.vk.com
2016-01-17 01:50:35,641 INFO [vk-requests] Session is already established
2016-01-17 01:50:35,641 INFO [vk-requests] Doing oauth2
2016-01-17 01:50:35,643 INFO [requests.packages.urllib3.connectionpool] Starting new HTTPS connection (1): oauth.vk.com
2016-01-17 01:50:35,791 INFO [vk-requests] Token will be expired in 0 sec.
2016-01-17 01:50:35,797 INFO [vk-requests] Done
2016-01-17 01:50:35,799 INFO [requests.packages.urllib3.connectionpool] Starting new HTTPS connection (1): api.vk.com
Traceback (most recent call last):
  File "C:/Git/simplestatus/status.py", line 286, in <module>
    main()
  File "C:/Git/simplestatus/status.py", line 282, in main
    newyear.sendresult()
  File "C:/Git/simplestatus/status.py", line 25, in sendresult
    api.status.set(text=sendstatus)
  File "C:\Pyhton350\lib\site-packages\vk_requests\api.py", line 60, in __call__
    return self._api.make_request(request_obj=self)
  File "C:\Pyhton350\lib\site-packages\vk_requests\api.py", line 32, in make_request
    return self._session.make_request(request_obj)
  File "C:\Pyhton350\lib\site-packages\vk_requests\auth.py", line 389, in make_request
    raise vk_error
vk_requests.exceptions.VkAPIError: error_code=15, message='Access denied: no access to call this method', request_params={'scope': 's,t,a,t,u,s', 'text': '1,3,6, ,Л,е,т, ,1,1, ,М,е,с,я,ц,е,в, ,1,4, ,Д,н,е,й, ', 'oauth': '1', 'method': 'status.set'}

My code:

def sendresult(self):
    sendstatus = self.__result()
    try:
        api = vk_requests.create_api(app_id=self._configappid(), login=self._configlogin(),
                                     password=self._configpassword(), scope='status')
    except vk_requests.exceptions.VkAuthError as vkautherror:
        print('Логин/Пароль невалиден: ' + str(vkautherror))
    else:
        api.status.set(text=sendstatus)
        print(sendstatus + ' Cтатус обновился ' + time.strftime('%H') + ' ' + time.strftime('%M') + ' ' +
              time.strftime('%S'))

Seems like 'create_api' dont send 'scope="status"' parameter. Or did I do something wrong?

prawn-cake commented 8 years ago

Confirm the problem. Let me see

UPD: fixed in 0.9.1 See README usage section how to use it

hograthm commented 8 years ago

Thanks a lot