[FIX] Token

This commit is contained in:
flyingrub
2016-09-27 20:06:15 +02:00
parent e862d2b2e0
commit bf81d2337e
3 changed files with 9 additions and 9 deletions

View File

@@ -4,7 +4,7 @@
import os
__version__ = 'v1.6'
__version__ = 'v1.6.1'
CLIENT_ID = 'bed20744714e9c5962c351efe15840ff'
ALT_CLIENT_ID = 'a3e059563d7fd3372b49b37f00a00bcf'
B_CLIENT_ID = '02gUJC0hH2ct1EGOcYXQIzRFU91c72Ea'

View File

@@ -7,13 +7,15 @@ from scdl import CLIENT_ID
class Client():
def get_collection(self, url, token):
params = {
'client_id': CLIENT_ID,
'linked_partitioning': '1',
}
if token:
params['oauth_token'] = token
resources = list()
while url:
response = requests.get(url, params={
'client_id': CLIENT_ID,
'linked_partitioning': '1',
'oauth_token': token,
})
response = requests.get(url, params=params)
response.raise_for_status()
json_data = response.json()
if 'collection' in json_data:

View File

@@ -263,12 +263,10 @@ def who_am_i():
"""
me = url['me'].format(token)
r = requests.get(me, params={'client_id': CLIENT_ID})
r.raise_for_status()
current_user = r.json()
logger.debug(me)
if r.status_code == 401:
logger.error('Invalid token...')
sys.exit(0)
logger.info('Hello {0}!'.format(current_user['username']))
logger.newline()
return current_user