Python Forum
HTTP response capturing issue
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HTTP response capturing issue
#1
I want to catch a specific HTTP error and not any one of the entire family.. what I was trying to do is
import urllib2
try:
   urllib2.urlopen("some url")
except urllib2.HTTPError:
   <whatever>
but what I end up is catching any kind of HTTP error, but I want to catch only if the specified webpage doesn't exist!! probably that's HTTP error 404..but I don't know how to specify that catch only error 404 and let the system run the default handler for other events.
Reply


Messages In This Thread
HTTP response capturing issue - by miunika - Mar-16-2019, 11:44 AM
RE: HTTP response capturing issue - by Larz60+ - Mar-16-2019, 01:46 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Capturing BS4 values into DF and writing to CSV cubangt 18 2,044 Sep-05-2023, 01:57 PM
Last Post: cubangt
  capturing multiline output for number of parameters jss 3 863 Sep-01-2023, 05:42 PM
Last Post: jss
  Json filter is not capturing desired key/element mrapple2020 1 1,187 Nov-24-2022, 09:22 AM
Last Post: ibreeden
  ModuleNotFoundError: No module named 'http.client'; 'http' is not a package abhishek81py 1 15,610 Jun-25-2020, 08:58 AM
Last Post: buran
  Capturing inputs values from internal python script limors11 11 5,265 Jun-16-2019, 05:05 PM
Last Post: DeaD_EyE
  Capturing a snapshot from the video sreeramp96 1 2,199 May-24-2019, 07:02 AM
Last Post: heiner55
  httplib to http.client conversion issue zatlas1 1 2,628 Apr-12-2019, 05:21 PM
Last Post: Larz60+
  HTTP response capturing issue anna 2 2,547 Mar-15-2019, 03:08 PM
Last Post: Larz60+
  HTTP 400 response code eshwinsukhdeve 1 1,766 Mar-03-2019, 06:11 PM
Last Post: Larz60+
  Capturing error from sql Grego 1 2,484 Jun-29-2018, 11:17 AM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020