Пример #1
0
    def test_http_error(self, mrs_mock):
        mm = mrs_mock.return_value = mock.MagicMock()

        mm.post.side_effect = requests.exceptions.ConnectTimeout('test')

        with self.assertRaises(wa.HTTPError):
            wa.WebAuth('a', 'b').login()

        mm.post.reset_mock()
        mm.post.side_effect = requests.exceptions.ReadTimeout('test')

        with self.assertRaises(wa.HTTPError):
            wa.WebAuth('c', 'd').login()
Пример #2
0
def authorization(account):
    try:
        global user
        user = sw.WebAuth(account[:account.index(":")])
        session = user.login(account[account.index(":") + 1:])
        return session
    except (sw.CaptchaRequired, sw.LoginIncorrect, sw.EmailCodeRequired,
            sw.TwoFactorCodeRequired) as exp:
        if isinstance(exp, sw.LoginIncorrect):
            print(
                colored(account, "yellow") + colored("\t|\t", "blue") +
                colored("LoginIncorrect", "red"))
        elif isinstance(exp, sw.CaptchaRequired):
            print(
                colored(account, "yellow") + colored("\t|\t", "blue") +
                colored("Capthca detected", "red"))
        elif isinstance(exp, sw.EmailCodeRequired):
            print(
                colored(account, "yellow") + colored("\t|\t", "blue") +
                colored("EmailCode detected", "red"))
        elif isinstance(exp, sw.TwoFactorCodeRequired):
            print(
                colored(account, "yellow") + colored("\t|\t", "blue") +
                colored("TwoFactor detected", "red"))
        return False
    except:
        print(
            colored(account, "yellow") + colored("\t|\t", "blue") +
            colored("Unknown error", "red"))
        return False
def get_session():
    username = input('Please Enter User Name')
    password = input('Please Enter Password')
    captcha = None
    twofactor = None
    print(username, password)
    while True:
        try:
            user = wa.WebAuth(username, password)
        except (wa.CaptchaRequired, wa.LoginIncorrect) as exp:
            print(exp)
            if isinstance(exp, LoginIncorrect):
                password = input('Please Enter Correct Password')
            if isinstance(exp, wa.CaptchaRequired):
                print('Please Solve Captcha')
                print(user.captcha_url)
            else:
                print('other exceptiion')
                captcha = None
        else:
            break
    while True:
        twofactor = input('Please Enter TwoFactorCode')
        user.login(twofactor_code=twofactor)
        break
        try:
            user.login(twofactor_code=twofactor)
        except wa.TwoFactorCodeRequired:
            twofactor = input('Please Enter TwoFactorCode')
        except exceptiion as e:
            print(e)
        else:
            print('Login Success')
            break
    return user.session
Пример #4
0
 def __init__(self, login, password, app_id=440, currency=1, country='RU'):
     self.APP_ID = app_id
     self.CURRENCY = currency
     self.COUNTRY = country
     self._login = login
     self._password = password
     user = wa.WebAuth(login)
     self._session = user.cli_login(password)
Пример #5
0
def auth_steam():
    """
    Login to Steam via CLI and returns the authenticated websession
    """
    print("Login to your Steam Account:")
    username = str(input("Enter username: ")).strip()
    session = wa.WebAuth(username).cli_login()
    return session
Пример #6
0
 def __init__(self, *, username: str, pw: str = '', mfa: str = '', prompt: bool = False, appid: str = '346110'):
     self._arksurvival_app_id = appid
     self._user = wa.WebAuth(username)
     if prompt:
         self._session = self._user.cli_login()
     else:
         self._session = self._user.login(password=pw, twofactor_code=mfa)
     self._results = {}
Пример #7
0
def login(username, password):
    user = wa.WebAuth(username, password)
    try:
        session = user.login()
    except wa.CaptchaRequired:
        print(user.captcha_url)
        # ask a human to solve captcha
        session = user.login(captcha=input("Insert captcha: "))
    except wa.EmailCodeRequired:
        session = user.login(email_code=input("Check code in e-mail: "))
    except wa.TwoFactorCodeRequired:
        session = user.login(twofactor_code=input("Check Two Factor Auth Code: "))
    return session
Пример #8
0
    def test_login_user_and_pass_only_ok(self):
        user = wa.WebAuth('testuser', 'testpass')
        s = user.login()

        self.assertTrue(user.complete)
        self.assertIsInstance(s, requests.Session)

        for domain in s.cookies.list_domains():
            self.assertEqual(s.cookies.get('steamLogin', domain=domain), '0%7C%7C{}'.format('A'*16))
            self.assertEqual(s.cookies.get('steamLoginSecure', domain=domain), '0%7C%7C{}'.format('B'*16))
            self.assertEqual(s.cookies.get('steamMachineAuth0', domain=domain), 'C'*16)

        self.assertEqual(s, user.login())
Пример #9
0
 def __init__(self, username, password, secrets=None, deviceId=None):
     self.user = wa.WebAuth(username, password)
     if secrets is not None:
         self.mobile = wa.MobileWebAuth(username, password)
         self.sa = SteamAuthenticator(secrets)
     else:
         self.mobile = None
         self.sa = None
     self.deviceId = deviceId
     self.login()
     self.baseURL = 'https://steamcommunity.com'
     self.urlToId = {}
     self.SIDDB = requests.Session()
     print(f'Steam User: {self.user.steam_id.as_64} Logged.')
def steam_login():
    # Sign into Steam web

    # Attempt to use saved session
    r = requests.Session()
    if try_recover_cookies(".steamcookies", r) and verify_logins_session(r)[1]:
        return r

    # Saved state doesn't work, prompt user to sign in.
    s_username = input("Steam Username: "******".steamcookies", session)
    return session
Пример #11
0
    def steam_login(self):
        try:
            user = wa.WebAuth(self._acc_name, self._acc_pas)
            session = user.login()
            self.__errors = 0
            return session, user

        except Exception as e:
            print(e, ' ', self._acc_name, ':', self._acc_pas)
            if self.__errors >= self._max_errors:
                print('Max erors')
                return False, False
            self.__errors = self.__errors + 1
            time.sleep(self._sleep_time)
            return self.steam_login()
Пример #12
0
def login():
    'logs into steam, returns requests session with chrome headers and relevant cookies'
    header = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64)'
          ' AppleWebKit/537.36 (KHTML, like Gecko)'
          ' Chrome/68.0.3440.84 Safari/537.36'}

    file = load_id()
    user = webauth.WebAuth(file['username'], file['password'])
    twofaurl = '{}2fa%20{}'.format(file['asfcommand'], file['bot'])
    twofa = requests.post(twofaurl,data='')
    twofa = twofa.json()['Result'][-5:]
    time.sleep(2) #since it can take a while for asf to respond
    steamsession = user.login(twofactor_code=twofa)
    steamsession.headers.update(header)
    return steamsession
Пример #13
0
    def __init__(
        self,
        login: str,
        password: str,
        content_id: str,
        author_id: str,
        words_blacklist: tuple,
        users_blacklist: tuple = (),
        users_whitelist: tuple = ()
    ) -> None:

        self.__user = wa.WebAuth(login, password)
        self.__session = None

        self.content_id = content_id
        self.author_id = author_id
        self.USERS_BLACKLIST = users_blacklist
        self.USERS_WHITELIST = users_whitelist
        self.WORDS_BLACKLIST = words_blacklist

        self.set_session()
Пример #14
0
def login_clicked():
    btn_login.configure(text="Logging in...")
    lbl_verbose.configure(text="Starting...")
    options = Options()
    options.add_argument('--headless')
    username = txt_username.get()
    password = txt_password.get()
    mfa = txt_2fa.get()
    user = wa.WebAuth(username, password)
    session = user.login(twofactor_code=mfa)
    session.get('https://steamcommunity.com')
    page = requests.get("https://isthereanydeal.com/#/")
    soup = BeautifulSoup(page.content, 'html.parser')
    table = soup.find(class_="cntBoxContent")
    links = table.find_all(class_="lg")
    tags = []
    for i in links:
        tags.append(i.get('href'))
    str_list = (filter(None, tags))
    str_list = list(set(str_list))
    links_list = []
    for i in str_list:
        links_list.append(i)
    def SteamAccess(gameLink):
        driver = webdriver.Firefox(options=options)
        driver.get(gameLink)
        for c in session.cookies :
            driver.add_cookie({'name': c.name, 'value': c.value, 'path': c.path, 'expiry': c.expires})
        driver.get(gameLink) #Fix?
        driver.add_cookie
        try:
            web = driver.find_element_by_class_name("btn_addtocart").click()
        except:
            pass
        finally:
            driver.quit()
    lbl_verbose.configure(text="Sending Requests...")
    for i in links_list:
        SteamAccess(i)
    btn_login.configure(text="Done!", bg="green")
Пример #15
0
def steam_login():
    # Login to steam
    user = wa.WebAuth(email, password)
    try:
        user.login()
    except wa.CaptchaRequired:
        print("Please complete the captcha: " + user.captcha_url)
        captcha_code = input("Please input the captcha response code: ")
        user.login(captcha=captcha_code)
    except wa.EmailCodeRequired:
        email_code = input("Please input the email verification code: ")
        user.login(email_code=email_code)
    except wa.TwoFactorCodeRequired:
        tfa_code = input("Please input the 2FA code: ")
        user.login(twofactor_code=tfa_code)
    # Copy cookies to session
    s.cookies.update(user.session.cookies)
    while True:
        try:
            entrance = s.get(
                'https://auth-ac.my.com/social/steam?continue=https://account.my.com/social_back/?continue=https://wf.my.com/en/&failure=https://account.my.com/social_back/?soc_error=1&continue=https://wf.my.com/en/'
            )
            openid_login = {}
            html = StringIO(entrance.content.decode())
            tree = lxml.html.parse(html)
            root = tree.getroot()
            for form in root.xpath('//form[@name="loginForm"]'):
                for field in form.getchildren():
                    if 'name' in field.keys():
                        openid_login[field.get('name')] = field.get('value')
            s.headers.update({'referer': entrance.url})
            steam_redir = s.post('https://steamcommunity.com/openid/login',
                                 data=openid_login)
            s.get('https://auth-ac.my.com/sdc?from=https%3A%2F%2Fwf.my.com')
            get_token = s.get('https://wf.my.com/minigames/user/info').json()
            s.cookies['mg_token'] = get_token['data']['token']
            s.cookies['cur_language'] = 'en'
        except:
            continue
        break
Пример #16
0
def main():
    global file, stop, switch
    print('Logging into steam...')
    user = wa.WebAuth(steam_user, password=steam_pass)
    success = False
    while not success:
        try:
            user.login()
        except wa.HTTPError:
            print('Connection failed, retrying...')
            time.sleep(5)
        except wa.EmailCodeRequired:
            print('Connected to server')
            success = True
    success = False
    while not success:
        time.sleep(5)
        code = input("code: ")  #get_code()
        try:
            sess = user.login(steam_pass, email_code=code)
            success = True
        except:
            pass
    form = sess.post(steam_link)
    watch = threading.Thread(target=watcher, args=())
    watch.start()
    print(f'Logged into steam, watching for kills (hold "{stop_key}" to stop)')
    print(f'Hold {trigger_key} to switch PFP at any time')
    while not stop:
        if trigger() or switch:
            winsound.PlaySound(util + 'alert.wav', winsound.SND_FILENAME)
            print('Changing PFP...')
            file = random.choice(glob.glob('images/*'))
            data = get_data(form, file)
            r = sess.post(upload_url, files=data)
            switch = False
            print('PFP changed to ' + str(file))
            time.sleep(3)
        time.sleep(1)
Пример #17
0
def steamiscool():
    print(
        Fore.CYAN +
        """███████╗████████╗███████╗ █████╗ ███╗   ███╗     ██████╗ ███████╗███╗   ██╗     ██████╗██╗  ██╗███████╗ ██████╗██╗  ██╗███████╗██████╗ 
██╔════╝╚══██╔══╝██╔════╝██╔══██╗████╗ ████║    ██╔════╝ ██╔════╝████╗  ██║    ██╔════╝██║  ██║██╔════╝██╔════╝██║ ██╔╝██╔════╝██╔══██╗
███████╗   ██║   █████╗  ███████║██╔████╔██║    ██║  ███╗█████╗  ██╔██╗ ██║    ██║     ███████║█████╗  ██║     █████╔╝ █████╗  ██████╔╝
╚════██║   ██║   ██╔══╝  ██╔══██║██║╚██╔╝██║    ██║   ██║██╔══╝  ██║╚██╗██║    ██║     ██╔══██║██╔══╝  ██║     ██╔═██╗ ██╔══╝  ██╔══██╗
███████║   ██║   ███████╗██║  ██║██║ ╚═╝ ██║    ╚██████╔╝███████╗██║ ╚████║    ╚██████╗██║  ██║███████╗╚██████╗██║  ██╗███████╗██║  ██║
╚══════╝   ╚═╝   ╚══════╝╚═╝  ╚═╝╚═╝     ╚═╝     ╚═════╝ ╚══════╝╚═╝  ╚═══╝     ╚═════╝╚═╝  ╚═╝╚══════╝ ╚═════╝╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝
                                                                                                                                       """
        + Fore.RESET)
    y = input(Fore.WHITE + "Do you want to generate codes? [yes/no]: ")
    if (y) == ("yes"):

        def bla():
            codelen = 5
            bros = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
            return ''.join(random.choice(bros) for i in range(codelen))

        def blb():
            codelen = 5
            bros = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
            return ''.join(random.choice(bros) for i in range(codelen))

        def blc():
            codelen = 5
            bros = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
            return ''.join(random.choice(bros) for i in range(codelen))

        j = int(input("Enter the number of codes you want to print: "))
        for i in range(j):
            print(bla(), "-", blb(), "-", blc(), sep="")
        l = input(Fore.MAGENTA +
                  "copy the code and paste it in keys.txt and press enter.")
        if (l) == (""):
            print(Fore.GREEN + "Welcome to the steam code checker.")

            keyFileName = "keys.txt"
            p = input(Fore.YELLOW + "Enter your steam username : "******"Enter the password for the steam account : ")
            user = wa.WebAuth(p, b)

            try:
                user.login()
            except wa.CaptchaRequired:
                print(user.captcha_url)
                code = input(
                    Fore.RED +
                    "Please follow the captcha url, enter the code below:\n")
                user.login(captcha=code)
            except wa.EmailCodeRequired:
                code = input(Fore.RED + "Please enter emailed 2FA code:\n")
                user.login(email_code=code)
            except wa.TwoFactorCodeRequired:
                code = input(
                    Fore.RED +
                    "Please enter 2FA code from the Steam app on your phone:\n"
                )
                user.login(twofactor_code=code)

    # Get the sesssion ID, required for the ajax key auth
            sessionID = user.session.cookies.get_dict()["sessionid"]

            keys = []
            f = open(keyFileName)
            for line in f:
                keys.append(line)

    # Iterate over keys, if you need faster than this for some unknown reason you've probably got the skill to make this faster.
            for key in keys:
                r = user.session.post(
                    'https://store.steampowered.com/account/ajaxregisterkey/',
                    data={
                        'product_key': key,
                        'sessionid': sessionID
                    })
                blob = json.loads(r.text)

                # Success
                if blob["success"] == 1:
                    for item in blob["purchase_receipt_info"]["line_items"]:
                        print(Fore.GREEN + "[ Redeemed ]",
                              item["line_item_description"])
                else:
                    # Error codes from https://steamstore-a.akamaihd.net/public/javascript/registerkey.js?v=qQS85n3B1_Bi&l=english
                    errorCode = blob["purchase_result_details"]
                    sErrorMessage = ""
                    if errorCode == 14:
                        sErrorMessage = 'The product code you\'ve entered is not valid. Please double check to see if you\'ve mistyped your key. I, L, and 1 can look alike, as can V and Y, and 0 and O.'

                    elif errorCode == 15:
                        sErrorMessage = 'The product code you\'ve entered has already been activated by a different Steam account. This code cannot be used again. Please contact the retailer or online seller where the code was purchased for assistance.'

                    elif errorCode == 53:
                        sErrorMessage = 'The product code you\'ve entered is not valid. Please double check to see if you\'ve mistyped your key. I, L, and 1 can look alike, as can V and Y, and 0 and O.'

                    elif errorCode == 13:
                        sErrorMessage = 'Sorry, but this product is not available for purchase in this country. Your product key has not been redeemed.'

                    elif errorCode == 9:
                        sErrorMessage = 'This Steam account already owns the product(s) contained in this offer. To access them, visit your library in the Steam client.'

                    elif errorCode == 24:
                        sErrorMessage = 'The product code you\'ve entered requires ownership of another product before activation.\n\nIf you are trying to activate an expansion pack or downloadable content, please first activate the original game, then activate this additional content.'

                    elif errorCode == 36:
                        sErrorMessage = 'The product code you have entered requires that you first play this game on the PlayStation®3 system before it can be registered.\n\nPlease:\n\n- Start this game on your PlayStation®3 system\n\n- Link your Steam account to your PlayStation®3 Network account\n\n- Connect to Steam while playing this game on the PlayStation®3 system\n\n- Register this product code through Steam.'

                    elif errorCode == 50:
                        sErrorMessage = 'The code you have entered is from a Steam Gift Card or Steam Wallet Code. Browse here: https://store.steampowered.com/account/redeemwalletcode to redeem it.'

                    else:
                        sErrorMessage = 'An unexpected error has occurred.  Your product code has not been redeemed.  Please wait 30 minutes and try redeeming the code again.  If the problem persists, please contact <a href="https://help.steampowered.com/en/wizard/HelpWithCDKey">Steam Support</a> for further assistance.'

                    print(Fore.RED + "[ Error ]", sErrorMessage)

        c = input("Press Enter to close ...")

    elif y == ('no'):
        print(
            "You have said no, make sure you have keys generated in the keys.txt file"
        )
        print("Welcome to the steam code checker!")
        keyFileName = "keys.txt"
        u = input("Enter your steam username : "******"Enter the password for the steam account : ")
        user = wa.WebAuth(u, z)

        # Create a login session
        try:
            user.login()
        except wa.CaptchaRequired:
            print(user.captcha_url)
            code = input(
                "Please follow the captcha url, enter the code below:\n")
            user.login(captcha=code)
        except wa.EmailCodeRequired:
            code = input("Please enter emailed 2FA code:\n")
            user.login(email_code=code)
        except wa.TwoFactorCodeRequired:
            code = input(
                "Please enter 2FA code from the Steam app on your phone:\n")
            user.login(twofactor_code=code)
        except wa.LoginIncorrect:
            print(Fore.RED + "Incorrect Username Or Password!")
            time.sleep(2)
            os.system('cls')
            steamiscool()

    # Get the sesssion ID, required for the ajax key auth
        sessionID = user.session.cookies.get_dict()["sessionid"]

        keys = []
        f = open(keyFileName)
        for line in f:
            keys.append(line)

    # Iterate over keys, if you need faster than this for some unknown reason you've probably got the skill to make this faster.
        for key in keys:
            r = user.session.post(
                'https://store.steampowered.com/account/ajaxregisterkey/',
                data={
                    'product_key': key,
                    'sessionid': sessionID
                })
            blob = json.loads(r.text)

            # Success
            if blob["success"] == 1:
                for item in blob["purchase_receipt_info"]["line_items"]:
                    print("[ Redeemed ]", item["line_item_description"])
            else:
                # Error codes from https://steamstore-a.akamaihd.net/public/javascript/registerkey.js?v=qQS85n3B1_Bi&l=english
                errorCode = blob["purchase_result_details"]
                sErrorMessage = ""
                if errorCode == 14:
                    sErrorMessage = 'The product code you\'ve entered is not valid. Please double check to see if you\'ve mistyped your key. I, L, and 1 can look alike, as can V and Y, and 0 and O.'

                elif errorCode == 15:
                    sErrorMessage = 'The product code you\'ve entered has already been activated by a different Steam account. This code cannot be used again. Please contact the retailer or online seller where the code was purchased for assistance.'

                elif errorCode == 53:
                    sErrorMessage = 'There have been too many recent activation attempts from this account or Internet address. Please wait and try your product code again later.'

                elif errorCode == 13:
                    sErrorMessage = 'Sorry, but this product is not available for purchase in this country. Your product key has not been redeemed.'

                elif errorCode == 9:
                    sErrorMessage = 'This Steam account already owns the product(s) contained in this offer. To access them, visit your library in the Steam client.'

                elif errorCode == 24:
                    sErrorMessage = 'The product code you\'ve entered requires ownership of another product before activation.\n\nIf you are trying to activate an expansion pack or downloadable content, please first activate the original game, then activate this additional content.'

                elif errorCode == 36:
                    sErrorMessage = 'The product code you have entered requires that you first play this game on the PlayStation®3 system before it can be registered.\n\nPlease:\n\n- Start this game on your PlayStation®3 system\n\n- Link your Steam account to your PlayStation®3 Network account\n\n- Connect to Steam while playing this game on the PlayStation®3 system\n\n- Register this product code through Steam.'

                elif errorCode == 50:
                    sErrorMessage = 'The code you have entered is from a Steam Gift Card or Steam Wallet Code. Browse here: https://store.steampowered.com/account/redeemwalletcode to redeem it.'

                else:
                    sErrorMessage = 'An unexpected error has occurred.  Your product code has not been redeemed.  Please wait 30 minutes and try redeeming the code again.  If the problem persists, please contact <a href="https://help.steampowered.com/en/wizard/HelpWithCDKey">Steam Support</a> for further assistance.'

                print("[ Error ]", sErrorMessage)

            time.sleep(2)
            os.system('cls')
            steamiscool()
    else:
        print('Invalid Choice... Trying Again...')
        time.sleep(2)
        os.system('cls')
        steamiscool()
Пример #18
0
    # Collect installed mod IDs (excluding missions)
    # Addons should always have a meta.cpp file in their root
    installed_mod_ids = set([dir for dir in listdir(_mod_dir_path) if 'meta.cpp' in listdir(path.join(_mod_dir_path, dir))])
    print(str.format('Found {} mods currently installed', len(installed_mod_ids)))

    # Subtract the mod IDs in the modlists from those installed to get the redundant ones we need to remove
    mod_ids_to_unsub = installed_mod_ids - mod_ids
    print(str.format('Removing {} redundant mods not included in any modlist', len(mod_ids_to_unsub)))

    # Interface with the Steam client and create a web client
    # steam_client = steamclient.SteamClient()
    # steam_client.cli_login()
    # steam_web = steam_client.get_web_session()
    # OR...
    steam_auth = webauth.WebAuth(input('Steam username: '******'[{}/{}] Unsubscribing from {}...', index, len(mod_ids_to_unsub), id), end=' ')
        res = steam_web.post('https://steamcommunity.com/sharedfiles/unsubscribe', {'appid': '107410', 'id': id, 'sessionid': steam_auth.session_id})
        if res.status_code == 200:
            unsubbed_mod_ids.add(id)
            print('Success')
        else:
            print('Failed')
Пример #19
0
import steam.webauth as wa
import requests
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from tqdm import tqdm

options = Options()
options.add_argument('--headless')

username = input("Steam Username: "******"Steam Password: "******"Steam Authenticator Code: ")

user = wa.WebAuth(username, password)
session = user.login(twofactor_code=mfa)
session.get('https://steamcommunity.com')

page = requests.get("https://isthereanydeal.com/#/")
soup = BeautifulSoup(page.content, 'html.parser')

table = soup.find(class_="cntBoxContent")
sales = table.find_all(class_="bundle-container-outer bundle-preview giveaway")
#bundles = table.find_all(class_="bundle-container-outer bundle-preview bundle")
links = table.find_all(class_="lg")

tags = []
for i in links:
    tags.append(i.get('href'))

str_list = (filter(None, tags))
Пример #20
0
 def test_login_user_and_pass_only_fail(self):
     with self.assertRaises(wa.LoginIncorrect):
         wa.WebAuth('testuser', 'testpass').login()
         wa.WebAuth('testuser').login('testpass')
Пример #21
0
import re
from getpass import getpass
import steam.webauth as wa

try:
    user_input = raw_input
except NameError:
    user_input = input

username = user_input("Username: "******"Password: "******"Captcha:" + webclient.captcha_url)
    webclient.login(captcha=user_input("Captcha code: "))
except wa.EmailCodeRequired:
    webclient.login(email_code=user_input("Email code: "))
except wa.TwoFactorCodeRequired:
    webclient.login(twofactor_code=user_input("2FA code: "))

if webclient.complete:
    resp = webclient.session.get(
        'https://store.steampowered.com/account/store_transactions/')
    resp.raise_for_status()
    balance = re.search(r'store_transactions/">(?P<balance>.*?)</a>',
                        resp.text).group('balance')
    print("Current balance: %s" % balance)
Пример #22
0
def user_pass_only_fail(u, p):
    try:
        wa.WebAuth(u, p).login()
    except wa.LoginIncorrect:
        pass
Пример #23
0
def user_pass_only_success(u, p):
    wa.WebAuth(u, p).login()
Пример #24
0
def calc_num_items(item_dict):
    """
    Calculates the total number of items to be used in the progress bar
    """
    return sum([len(items) for items in item_dict.values()])


if __name__ == '__main__':
    with open('../data/market_item_list.txt') as f:
        item_dict = ast.literal_eval(
            f.read())  # This file looks like [{app_id: app_name}...]
    client = MongoClient()
    db = client['steam_capstone']
    collection = db['skipped']
    collection = db['market']
    user = wa.WebAuth(os.environ['STEAM_ID'], os.environ["STEAM_PASSWORD"])
    session = user.login()  # login to Steam
    i = 0
    if i % 10000 == 0:  # Re-login every 10000 items
        user = wa.WebAuth(os.environ['STEAM_ID'], os.environ["STEAM_PASSWORD"])
        session = user.login()
    total = calc_num_items(item_dict)
    duplicate = True  # If I need to restart, I want to record how many items I've been through for the progress bar
    response = True
    last_item = 'Leopard Suit'  # Manually placed when the script is paused
    last_app = 244850  # Manually placed when the script is paused
    for app, items in item_dict.items():
        for item in items.keys():
            progress(i, total, str(app) + ' ' + item)
            i += 1
            if item == last_item and app == last_app:  # Keep looping until I'm back at the last item
Пример #25
0
import steam.webauth as wa
import datetime					
import requests
import Redeem


#date and time
now = datetime.datetime.now()
date = '=====' + str(now.strftime("%Y-%m-%d %H:%M")) + '=====\n'

#Steam login and password
user = wa.WebAuth('Tramlex', 'TimAlex1256') 

#Possible exceptions (Captcha, two-factor code, etc.)
try:
	user.login()
except wa.LoginIncorrect:
	print "Either login or password is incorrect. Please try again."
	raise SystemExit
except wa.TwoFactorCodeRequired:
	TwoFactorCode = raw_input("Enter the two-factor code: ")
	user.login(twofactor_code = TwoFactorCode)
except wa.CaptchaRequired:
	print user.captcha_url
	Captcha = raw_input("Enter the captcha from the url: ")
	user.login(captcha = Captcha)
except wa.EmailCodeRequired:
	EmailCode = raw_input("Enter the email code: ")
	user.login(email_code = EmailCode)

sessionID = user.session.cookies.get_dict()["sessionid"]
Пример #26
0
# -*- coding: utf-8 -*-
import time
import random
import json
import requests
import steam.webauth as wa

login = ''
password = ''
gameID = '440'

user = wa.WebAuth(login)
session = user.cli_login(password)

def get_items(currPos):
    r = session.get('https://steamcommunity.com/market/search/render/?start='+str(currPos)+'&count=100&search_descriptions=0&sort_column=default&sort_dir=desc&appid='+gameID+'&norender=1&count=5000')
    allItems = json.loads(r.text)['results']
    items = [item['hash_name'] for item in allItems]
    return items

def save_items(items):
    with open('./names.txt', 'a', encoding='utf-8') as f:
        for item in items:
            f.write("%s\n" % item)

def scrape_names():
    # 1 Step get all items count
    r = session.get('https://steamcommunity.com/market/search/render/?search_descriptions=0&sort_column=default&sort_dir=desc&appid='+gameID+'&norender=1&count=100')
    totalItems = json.loads(r.text)['total_count']
    print(totalItems)
    # 2 Step parse items