Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Weird HTTP response
#3
I saved the Response object as an html file and opened it in my browser. Here's the code I used to make the request:

def get_response(url):
    """Obtains Response object from page at url, with error-checking.

        :url:           Url accessed.

        :returns:       Response object.
    """
    try:
        response = requests.get(url, headers=HEADER, timeout=TIMEOUT)
        print("Response code: {}.".format(response.status_code))
        try:
            response.raise_for_status()
        except Exception as HTTPerror:
            print("HTTP error on url {}: {}.".format(url, HTTPerror))
        return response
    except Exception as error:
        print("Error in get_response(): {}.".format(error))
Would loading the response object into a Python script permit me to access all of its methods and attributes, now that I've saved it as an html file using "bw" and encode("utf-8). If that's the case, I can just upload the object somewhere and give you a password to download it.

Thanks for your help.
Reply


Messages In This Thread
Weird HTTP response - by league55 - Feb-21-2018, 12:59 AM
RE: Weird HTTP response - by abhin - Feb-21-2018, 03:12 AM
RE: Weird HTTP response - by league55 - Feb-21-2018, 04:36 AM
RE: Weird HTTP response - by Larz60+ - Feb-21-2018, 05:12 AM
RE: Weird HTTP response - by league55 - Feb-22-2018, 08:41 AM
RE: Weird HTTP response - by Larz60+ - Feb-22-2018, 12:03 PM
RE: Weird HTTP response - by league55 - Feb-22-2018, 04:46 PM
RE: Weird HTTP response - by wavic - Feb-22-2018, 05:20 PM
RE: Weird HTTP response - by Larz60+ - Feb-22-2018, 06:54 PM

Forum Jump:

User Panel Messages

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