Esempio n. 1
0
 def upload(self, data):
     url = 'http://127.0.0.1:' + str(
         config.http_config['port']) + '/player/upload'
     header = {'token': Data.find(Relay.player, [('id', '=', 1)])['token']}
     res = common_tools.post(url,
                             payload=data,
                             headers=header,
                             show_data=False,
                             show_headers=False)
     return res
Esempio n. 2
0
 def admin_login(self, user_name, pw):
     url = main_url + '/admin/login'
     data = {
         'username': user_name,
         'pswd': pw,
     }
     res = json.loads(
         common_tools.post(url, payload=data, headers=self.headers))
     # print(res)
     self.headers['token'] = res['data']['token']
     return res
Esempio n. 3
0
 def get_auth(self, code):
     request_url = 'https://api.weibo.com/oauth2/access_token'
     request_params = {
         'client_id': weibo_base.client_id,
         'client_secret': weibo_base.client_secret,
         'grant_type': 'authorization_code',
         'code': code,
         'redirect_uri': weibo_base.app_uri
     }
     request_url = request_url + '?' + common_tools.dict_to_url_params(
         request_params)
     res = common_tools.post(request_url,
                             show_data=False,
                             show_headers=False)
     res = json.loads(res)
     self.access_token = res["access_token"]
     self.end_time = res['expires_in']
     self.user_uid = res['uid']
     return
Esempio n. 4
0
 def search_by_id(self, data):
     url = main_url + '/uni/searchbyid'
     res = common_tools.post(url, payload=data, headers=self.headers)
     return res
Esempio n. 5
0
 def upload(self, data):
     url = main_url + '/admin/upload'
     res = common_tools.post(url, payload=data, headers=self.headers)
     return res
Esempio n. 6
0
 def admin_logout(self):
     url = main_url + '/admin/logout'
     res = common_tools.post(url, headers=self.headers)
     # print(res)
     return res
Esempio n. 7
0
 def upload(self, data):
     url = 'http://127.0.0.1:' + str(
         config.http_config['port']) + '/admin/upload'
     header = {'token': Data.find('admin', [('id', '=', 1)])['token']}
     res = common_tools.post(url, payload=data, headers=header)
     return res