Esempio n. 1
0
def get_comment(wbid, page):
    url = get_comment_url % (AC_TOKEN, wbid, page)
    print url
    broswer = SunusBroswer()
    resp = broswer.open(url).read_data()
    resp = json.loads(resp)
    cmts = []
    for c in resp['comments']:
        cmt = {
                'text': c['text'],
                'uname': c['user']['screen_name'],
                'uid': c['user']['idstr'],
                'cid': c['id'],
        }
        cmts.append(cmt)
    return cmts
Esempio n. 2
0
def init():
    global AC_TOKEN
    print 'goto\n%s\nto get code.' % user_comfire_page
    code = raw_input('code:\n')
    print code
    data = {
            'client_id': API_KEY,
            'client_secret': SECRET,
            'grant_type': 'authorization_code',
            'code': code,
            'redirect_uri': CALLBACK_PAGE
    }
    data = urllib.urlencode(data)
    broswer = SunusBroswer()
    resp = broswer.open(server_confirm_page, data=data).read_data()
    resp = json.loads(resp)
    AC_TOKEN = resp['access_token']
    if AC_TOKEN:
        print 'login successed'
        print AC_TOKEN