def _getUserInfo(self): ''' returns user info using vk api ''' # get vk user info api = vkontakte.api.API(token=self.__api_access_token) info = api.getProfiles( uids=self.__game_api_user_id, format='json', fields='bdate,sex,first_name,last_name,city,country') info = info[0] if 'bdate' in info: bdate = info['bdate'] else: bdate = None my_country = api.places.getCountryById(cids=int(info['country']))[0] info['country'] = my_country['name'] my_city = api.places.getCityById(cids=int(info['city']))[0] info['city'] = my_city['name'] game_info = GameInfo(city=info['city'], first_name=info['first_name'], last_name=info['last_name'], uid=long(info['uid']), country=info['country'], sex=long(info['sex']), bdate=bdate) return game_info
def _getUserInfo(self): # returns user info from OK # Step 7 - get OK userInfo # print 'FLOW[okutils.py]: OK():_getUserInfo()' post = { 'uids': self.__params['logged_user_id'], 'new_sig': 1, 'session_key': self.__params['session_key'], 'fields': u'uid,first_name,last_name,gender,birthday,locale,location', 'application_key': self.__params['application_key'], 'format': 'Json' } post_keys = sorted(post.keys()) param_str = "".join([ "%s=%s" % (str(key), vkontakte.api._encode(post[key])) for key in post_keys ]) param_str += self.__params['session_secret_key'] sign = md5(param_str).hexdigest().lower() post.update({'sig': sign}) # print '\tDEBUG[okutils.py]:_getUserInfo()->self._credentials.getSessionCookies() = ', self._credentials.getSessionCookies() info = requests.post( 'http://api.ok.ru/api/users/getInfo', data=post, cookies=self.str2dict( self._credentials.getSessionCookies())).json()[0] # print(info) game_info = GameInfo(city=info['location']['city'], first_name=info['first_name'], last_name=info['last_name'], uid=long(info['uid']), country=info['location']['country'], bdate=info['birthday']) return game_info
def _getUserInfo(self): post = { 'uids': self.__params['logged_user_id'], 'new_sig': 1, 'session_key': self.__params['session_key'], 'fields': u'uid,first_name,last_name,gender,birthday,locale,location', 'application_key': self.__params['application_key'], 'format': 'Json' } post_keys = sorted(post.keys()) param_str = "".join(["%s=%s" % (str(key), api._encode(post[key])) for key in post_keys]) param_str += self.__params['session_secret_key'] sign = md5(param_str).hexdigest().lower() post.update({'sig': sign}) info = requests.post('http://api.odnoklassniki.ru/api/users/getInfo', data=post, cookies=self.str2dict(self._credentials.getSessionCookies())).json()[0] game_info = GameInfo(city=info['location']['city'], first_name=info['first_name'], last_name=info['last_name'], uid=long(info['uid']), country=info['location']['country'], gender=info['gender'], bdate=info['birthday']) return game_info
def _getUserInfo(self): return GameInfo()
def _getUserInfo(self): ''' TODO returns user info using mailru api ''' return GameInfo()