示例#1
0
def qqauth(request):
    try:
        auth = OAuthHandler(settings.QQ_APP_KEY, settings.QQ_APP_SECRET, settings.QQ_CALLBACK)
        url = auth.get_authorization_url()
        request.session['qqauth'] = auth
        return HttpResponseRedirect(url)
    except Exception as e:
        logging.error(e)
        return HttpResponseRedirect('')
示例#2
0
def qqauth(request):
    try:
        auth = OAuthHandler(settings.QQ_APP_KEY, settings.QQ_APP_SECRET,
                            settings.QQ_CALLBACK)
        url = auth.get_authorization_url()
        request.session['qqauth'] = auth
        return HttpResponseRedirect(url)
    except Exception as e:
        logging.error(e)
        return HttpResponseRedirect('')
示例#3
0
def main():
    c = get_conf()
    o = OAuthHandler(c["consumer_key"], c["consumer_secret"])
    c["authorization_url"] = o.get_authorization_url()
    c["request_token"] = o.request_token
    print c["authorization_url"]
    verifier = raw_input("click the url above, then input the verifier: ")
    verifier = verifier.strip()
    c["verifier"] = verifier
    try:
        access_token = o.get_access_token(verifier)
        c["access_token_key"] = access_token.key
        c["access_token_secret"] = access_token.secret
        c["access_token"] = access_token.to_string()
        set_conf(c)
        print "oauth succeeded"
    except:
        print "oauth failed"
示例#4
0
def main():
    c = get_conf()
    o = OAuthHandler(c['consumer_key'], c['consumer_secret'])
    c['authorization_url'] = o.get_authorization_url()
    c['request_token'] = o.request_token
    print c['authorization_url']
    verifier = raw_input('click the url above, then input the verifier: ')
    verifier = verifier.strip()
    c['verifier'] = verifier
    try:
        access_token = o.get_access_token(verifier)
        c['access_token_key'] = access_token.key
        c['access_token_secret'] = access_token.secret
        c['access_token'] = access_token.to_string()
        set_conf(c)
        print 'oauth succeeded'
    except:
        print 'oauth failed'
示例#5
0
# simple use
from qqweibo import OAuthHandler, API, JSONParser, ModelParser
from qqweibo.utils import timestamp_to_str
import urllib, urllib2, http_helper

a = OAuthHandler('801486043', 'cd0a763d5f7d8be4f588b0f6f290fb06')
a = OAuthHandler('801486692', '35499dde285b599841fcee05aee4e28b')
a = OAuthHandler('801486694','122efd9274999d8eb06b185501611ca0')
aaaaa = OAuthHandler('801486696','c45b2b1afb0eae1e64466f7c9fd36319')
aaaaa = OAuthHandler('801486704','f8a0cb0327d53a71aba609707c3ea239')
aaaaa = OAuthHandler('801486706','ccb88ca0bd2d2ab59465abf45818567e')

# use this
url = a.get_authorization_url()
print 'authorization url:' + url
verifier = raw_input('PIN: ').strip()
a.get_access_token(verifier)

# or directly use:
#token = 'your token'
#tokenSecret = 'your secret'
#a.setToken(token, tokenSecret)
'''rhhgjkli'''

api = API(a)

#me = api.user.info()
#print me.name, me.nick, me.location


#nba = api.user.userinfo('NBA')