Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTPSConnectionPool: Max retries exceeded with url #395

Open
Aarab228 opened this issue Jul 1, 2024 · 0 comments
Open

HTTPSConnectionPool: Max retries exceeded with url #395

Aarab228 opened this issue Jul 1, 2024 · 0 comments

Comments

@Aarab228
Copy link

Aarab228 commented Jul 1, 2024

Exception:

HTTPSConnectionPool(host='steamcommunity.com', port=443): Max retries exceeded with url: / (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x00000279ECF87A40>: Failed to resolve 'steamcommunity.com' ([Errno 11002] getaddrinfo failed)"))

Actually, because of what it appeared I did not understand, before this I have never met this error, I rechecked the code several times (just in case), but it seems that the error implies that it is impossible to find the address for the provided URL, but if you look at the logs, you can see that the connection was still established and the cookie file was actually created. After authorization and cookie creation, the session stops working by calling Exception and terminates the rest of the function logic. The artificial call of the next function did not give any result.

Logs:
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): steamcommunity.com:443 DEBUG:urllib3.connectionpool:https://steamcommunity.com:443 "POST / HTTP/11" 200 8584 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.steampowered.com:443 DEBUG:urllib3.connectionpool:https://api.steampowered.com:443 "GET /IAuthenticationService/GetPasswordRSAPublicKey/v1?account_name=***** HTTP/11" 200 597 DEBUG:urllib3.connectionpool:https://api.steampowered.com:443 "POST /IAuthenticationService/BeginAuthSessionViaCredentials/v1 HTTP/11" 200 694 DEBUG:urllib3.connectionpool:https://api.steampowered.com:443 "POST /IAuthenticationService/UpdateAuthSessionWithSteamGuardCode/v1 HTTP/11" 200 41 DEBUG:urllib3.connectionpool:https://api.steampowered.com:443 "POST /IAuthenticationService/PollAuthSessionStatus/v1 HTTP/11" 200 668 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): login.steampowered.com:443 DEBUG:urllib3.connectionpool:https://login.steampowered.com:443 "POST /jwt/finalizelogin HTTP/11" 200 877 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): store.steampowered.com:443 DEBUG:urllib3.connectionpool:https://store.steampowered.com:443 "POST /login/settoken HTTP/11" 200 32 DEBUG:urllib3.connectionpool:https://steamcommunity.com:443 "POST /login/settoken HTTP/11" 200 32 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): help.steampowered.com:443 DEBUG:urllib3.connectionpool:https://help.steampowered.com:443 "POST /login/settoken HTTP/11" 200 12 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): checkout.steampowered.com:443 DEBUG:urllib3.connectionpool:https://checkout.steampowered.com:443 "POST /login/settoken HTTP/11" 200 32 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): steam.tv:443 DEBUG:urllib3.connectionpool:https://steam.tv:443 "POST /login/settoken HTTP/11" 200 32 INFO: Successful Authorization. Trying to get a balance... DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): steamcommunity.com:443 CRITICAL:root: The function sent an error! Function: login_create_cookie | Error: HTTPSConnectionPool(host='steamcommunity.com', port=443): Max retries exceeded with url: / (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x00000279ECF87A40>: Failed to resolve 'steamcommunity.com' ([Errno 11002] getaddrinfo failed)"))

Interesting fact, after authorization and cookie creation in the function login_create_cookie I call in the same function function get_balance, which by idea should return me the balance, with which I will carry out further manipulations, but after the first connection to the api was called an error in the function login_create_cookie

Full func:

async def login_create_cookie(login: str) -> None:
    if await verify_signature("flag_login_create_cookie") == "True":
        try:
            data = temp_mafile(login)
            client = SteamClient(api_key=data[0])
            client.login(username=data[1], password=data[2], steam_guard=f"{Constants.UPLOAD_FOLDER}\\maf_{login}.json")
            cookie = client._session.cookies.get_dict("steamcommunity.com") #fix cookie
            with open(f'{Constants.UPLOAD_FOLDER}/cookies_{login}.json', 'w', encoding='utf-8') as j:
                json.dump(cookie, j)
            logging.info('Successful Authorization. Trying to get a balance....')
            await get_balance(login)

            ... do something with balance ...

        except Exception as e:
            await error_wrapper(e)
    else:
        logging.critical('Disabled.')
        
    try:
        os.remove(f"{Constants.UPLOAD_FOLDER}\\maf_{login}.json")
        os.remove(f"{Constants.UPLOAD_FOLDER}\\maf.json")
    except Exception as e:
        logging.warning(f"Failed to delete temporary maFile. Error code: {e}")

Error_wrapper:

async def error_wrapper(message: str) -> logging.log:
    import traceback
    stack = traceback.extract_stack()
    source = stack[-2].name if len(stack) >=2 else "Unknown function"
    logging.critical(f"The function sent an error! Function: {source} | Error: {message}")

Finally, when I get an informational message(INFO: Successful Authorization. Trying to get a balance...) from login_create_cookie that a successful authorization has occurred, when I create the first session or request(DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): steamcommunity.com:443) I get an error (CRITICAL:root: The function sent an error! Function: login_create_cookie | Error: HTTPSConnectionPool(host='steamcommunity.com', port=443): Max retries exceeded with url: / (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x00000279ECF87A40>: Failed to resolve 'steamcommunity.com' ([Errno 11002] getaddrinfo failed)"))))

For the geniuses, I know that it means Max retries exceeded with url, however there was no error before, + I have implemented spam protection on the script side (no more than 1 request per 4 seconds).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant