예제 #1
0
    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.ok.ru/api/users/getInfo',
                             data=post).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'],
                             bdate=info['birthday'])
        global uid
        uid = info['uid']
        return game_info
예제 #2
0
    def _get_friends_list(self):
        post = {
            'new_sig': 1,
            'session_key': self._params['session_key'],
            '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.ok.ru/api/friends/getAppUsers', data=post).json()['uids']

        return info
예제 #3
0
 def _get_friend_info(self, friend):
     post = {
         'uids': friend,
         '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.ok.ru/api/users/getInfo', data=post).json()[0]
     print info
예제 #4
0
    def _get_friends_list(self):
        post = {
            'new_sig': 1,
            'session_key': self._params['session_key'],
            '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.ok.ru/api/friends/getAppUsers',
                             data=post).json()['uids']

        return info
예제 #5
0
 def _get_friend_info(self, friend):
     post = {
         'uids': friend,
         '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.ok.ru/api/users/getInfo',
                          data=post).json()[0]
     print info
예제 #6
0
    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.ok.ru/api/users/getInfo', data=post).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'], bdate=info['birthday'])
        global uid
        uid = info['uid']
        return game_info