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

python requests.get() stuck #6614

Closed
mominurr opened this issue Dec 25, 2023 · 1 comment
Closed

python requests.get() stuck #6614

mominurr opened this issue Dec 25, 2023 · 1 comment

Comments

@mominurr
Copy link

mominurr commented Dec 25, 2023

   url=links[x]
    
    try:
        response=requests.get(url,headers=HEADERLISTS,proxies={"http":proxy_lists[prox_index]},timeout=(10,10))
    except Exception as e:
        print("Error : ",e)
        sys.stderr = open('error.log', 'a+', encoding='utf-8')
        traceback.print_exc()
        sys.stderr.close()
        prox_index+=1
        time.sleep(1)
        continue
    if response.status_code==404:
        print("status code 404")
        prox_index+=1
        CURRENT_NUMBER+=1
        x+=1
        time.sleep(1)
        continue
    if response.status_code!=200:
        print("status code: ",response.status_code)
        prox_index+=1
        time.sleep(1)
        continue
    time.sleep(1)
    prox_index+=1
    CURRENT_NUMBER+=1
    x+=1

This is my code. Script running After sometime response is not comming and get stuck. Next iteration is not going. Please give me solution.

@Mariatta
Copy link

This doesn't look like a bug with requests library but with your code. Please ask in StackOverflow and using the python-requests tag.

@sigmavirus24 sigmavirus24 closed this as not planned Won't fix, can't repro, duplicate, stale Dec 25, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants