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

Connection problems #6701

Closed
maciek324 opened this issue May 14, 2024 · 1 comment
Closed

Connection problems #6701

maciek324 opened this issue May 14, 2024 · 1 comment
Labels
actions/autoclose-qa Used for automation to auto-close an issue Question/Not a bug

Comments

@maciek324
Copy link

Hello,
i´m pretty new in Python programming.
I have python3 and i installed requests via pip.

I cant connect to any site with .get...

my code:
import requests

r = requests.get('http://google.com', timeout=20)

print(r.status_code)

Output: see file Output.txt
Output.txt

If i try to catch exeptions:
Code:
import requests

try:
response = requests.get('https://google.com',timeout=20)
if response.status_code == 200:
print (response.json())
else:
print(f"Fehler beim Abrufen der Daten. Statuscode: {response.status_code}")
except Exception as e:
print(f"Fehler: {str(e)}")

Output:
Fehler: HTTPSConnectionPool(host='google.com', port=443): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x00000215B98DE900>: Failed to establish a new connection: [WinError 10051] A socket operation was related to an unavailable network'))

Is it a firewall or some connection problems ? I´m clueless

@maciek324 maciek324 added actions/autoclose-qa Used for automation to auto-close an issue Question/Not a bug labels May 14, 2024
Copy link

As described in the template, we won't be able to answer questions on this issue tracker. Please use Stack Overflow

@github-actions github-actions bot locked as off-topic and limited conversation to collaborators May 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
actions/autoclose-qa Used for automation to auto-close an issue Question/Not a bug
Projects
None yet
Development

No branches or pull requests

1 participant