forked from ticketfrei/ticketfrei
request token is a dict, not a string
This commit is contained in:
parent
45d4cd2062
commit
bf7c21c113
1
db.py
1
db.py
|
@ -79,6 +79,7 @@ class DB(object):
|
|||
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE,
|
||||
user_id INTEGER,
|
||||
request_token TEXT,
|
||||
request_token_secret TEXT,
|
||||
FOREIGN KEY(user_id) REFERENCES user(id)
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS twitter_accounts (
|
||||
|
|
11
user.py
11
user.py
|
@ -128,16 +128,17 @@ class User(object):
|
|||
return dict(foo='bar')
|
||||
|
||||
def save_request_token(self, token):
|
||||
db.execute("INSERT INTO twitter_request_tokens(user_id, request_token) VALUES(?, ?);",
|
||||
(self.uid, token))
|
||||
db.execute("INSERT INTO twitter_request_tokens(user_id, request_token, request_token_secret) VALUES(?, ?, ?);",
|
||||
(self.uid, token["oauth_token"], token["oauth_token_secret"]))
|
||||
db.commit()
|
||||
|
||||
def get_request_token(self):
|
||||
db.execute("SELECT request_token FROM twitter_request_tokens WHERE user_id = ?;", (id,))
|
||||
request_token = db.cur.fetchone()[0]
|
||||
db.execute("SELECT request_token, request_token_secret FROM twitter_request_tokens WHERE user_id = ?;", (id,))
|
||||
request_token = db.cur.fetchone()
|
||||
db.execute("DELETE FROM twitter_request_tokens WHERE user_id = ?;", (id,))
|
||||
db.commit()
|
||||
return request_token
|
||||
return {"oauth_token" : request_token[0],
|
||||
"oauth_token_secret" : request_token[1]}
|
||||
|
||||
def save_twitter_token(self, access_token, access_token_secret):
|
||||
db.execute(
|
||||
|
|
Loading…
Reference in a new issue