• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Error when accessing incorrect url in python requests

Resolved: Error when accessing incorrect url in python requests

0
By Isaac Tonny on 16/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

As shown in the code above, I want to print out “wrong” when I access an unusual url. However, the following error occurs.
Do you know the solution to this?

Answer:

It’s likely because the hostname can’t be resolved
Alternative could use try except block here

If you have better answer, please add a comment about this, thank you!

python python-requests
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: Visual Studio 2022 crashes when using breakpoints

24/03/2023

Resolved: How to get Union type from an array of objects in Flow?

24/03/2023

Resolved: Modify entity using Action in C#

24/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.