oauth
This commit is contained in:
parent
9107e00bb2
commit
dd7f82ee0b
1 changed files with 68 additions and 52 deletions
26
app.py
26
app.py
|
@ -9,6 +9,21 @@ from os import environ
|
||||||
import imaplib
|
import imaplib
|
||||||
import email
|
import email
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
from os import path
|
||||||
|
|
||||||
|
print('loggin into STEAM:', environ['STEAM_USERNAME'])
|
||||||
|
user = wa.MobileWebAuth(environ['STEAM_USERNAME'])
|
||||||
|
|
||||||
|
# try oauth token
|
||||||
|
try:
|
||||||
|
print('trying oauth login')
|
||||||
|
|
||||||
|
with open('oauth_token', 'r') as file:
|
||||||
|
user.oauth_login(file.read(), steam_id=environ['STEAM_ID'], language='english')
|
||||||
|
|
||||||
|
print('oauth login successful')
|
||||||
|
except (wa.LoginIncorrect, FileNotFoundError) as exp:
|
||||||
|
print('oauth login failed:', exp)
|
||||||
|
|
||||||
# get previously known message ids from imap server
|
# get previously known message ids from imap server
|
||||||
|
|
||||||
|
@ -22,10 +37,6 @@ old_msg_ids = data[0].split()
|
||||||
|
|
||||||
# perform steam login
|
# perform steam login
|
||||||
|
|
||||||
print('loggin into STEAM:', environ['STEAM_USERNAME'])
|
|
||||||
|
|
||||||
user = wa.WebAuth(environ['STEAM_USERNAME'])
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
user.login(environ['STEAM_PASSWORD'])
|
user.login(environ['STEAM_PASSWORD'])
|
||||||
except (wa.LoginIncorrect) as exp:
|
except (wa.LoginIncorrect) as exp:
|
||||||
|
@ -65,7 +76,12 @@ except wa.EmailCodeRequired:
|
||||||
break
|
break
|
||||||
|
|
||||||
print('code found:', code)
|
print('code found:', code)
|
||||||
user.login(email_code=code)
|
user.login(email_code=code, language='english')
|
||||||
|
|
||||||
|
with open('oauth_token', 'w') as file:
|
||||||
|
file.write(user.oauth_token)
|
||||||
|
|
||||||
|
print('password login successful')
|
||||||
|
|
||||||
# CRAWL
|
# CRAWL
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue