Esempio n. 1
0
def demo():
    twitter = OAuth(client_key=key, client_secret=secret)
    header = twitter.auth_header(request_url)
    r = requests.post(request_url, headers={"Authorization": header})
    token = parse_qs(r.text)["oauth_token"][0]
    auth = "{url}?oauth_token={token}".format(url=auth_url, token=token)
    return redirect(auth)
Esempio n. 2
0
def demo():
    twitter = OAuth(client_key=key,
                    client_secret=secret)
    header = twitter.auth_header(request_url)
    r = requests.post(request_url, headers={"Authorization":header})
    token = parse_qs(r.text)["oauth_token"][0]
    auth = "{url}?oauth_token={token}".format(url=auth_url, token=token)
    return redirect(auth)
Esempio n. 3
0
def post_update():
    post = { "status" : request.form["status_update"] }
    token_secret = session["token_secret"]
    access_token= session["access_token"]
     
    twitter = OAuth(client_key=key,
                    client_secret=secret,
                    token_secret=token_secret,
                    access_token=access_token)
    header = twitter.auth_header(update_url, post)
    r = requests.post(update_url, data=post, headers={"Authorization": header})
    return redirect("https://twitter.com/#!/%s" % session["screen_name"])
Esempio n. 4
0
def post_update():
    post = {"status": request.form["status_update"]}
    token_secret = session["token_secret"]
    access_token = session["access_token"]

    twitter = OAuth(client_key=key,
                    client_secret=secret,
                    token_secret=token_secret,
                    access_token=access_token)
    header = twitter.auth_header(update_url, post)
    r = requests.post(update_url, data=post, headers={"Authorization": header})
    return redirect("https://twitter.com/#!/%s" % session["screen_name"])
Esempio n. 5
0
def callback():
    verifier = request.args.get("oauth_verifier")
    token = request.args.get("oauth_token")
    twitter = OAuth(client_key=key,
                    client_secret=secret,
                    request_token=token,
                    verifier=verifier)
    header = twitter.auth_header(access_url)
    r = requests.post(access_url, headers={"Authorization" : header})
    info = parse_qs(r.text)
    session["access_token"] = info["oauth_token"][0]
    session["token_secret"] = info["oauth_token_secret"][0]
    session["screen_name"] = info["screen_name"][0]
    return """<html><head></head><body>
Esempio n. 6
0
def callback():
    verifier = request.args.get("oauth_verifier")
    token = request.args.get("oauth_token")
    twitter = OAuth(client_key=key,
                    client_secret=secret,
                    request_token=token,
                    verifier=verifier)
    header = twitter.auth_header(access_url)
    r = requests.post(access_url, headers={"Authorization": header})
    info = parse_qs(r.text)
    session["access_token"] = info["oauth_token"][0]
    session["token_secret"] = info["oauth_token_secret"][0]
    session["screen_name"] = info["screen_name"][0]
    return """<html><head></head><body>