Python Forum
Response [200] little help
Thread Rating:
  • 2 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Response [200] little help
#1
Hello,
Here is my code.
import requests

r = requests.get("http://www.noobmovies.com")
if r == 200:
    print("Website is up and running")

else:
    print("Web site is down")

    
print(r)
What the code should do is if I get a status code back of 200 it print out "Website is up and running", other than a 200 it prints "Web site is down"

The code does not do that. here is what I get

Web site is down
<Response [200]>
I don't know if the 200 is an int or a string. That could be the problem.
I will wait untill someone might know what is wrong with my code.
Thank You
renny Doh
Reply


Messages In This Thread
Response [200] little help - by Blue Dog - Jun-25-2017, 12:59 PM
RE: Response [200] little help - by ichabod801 - Jun-25-2017, 01:12 PM
RE: Response [200] little help - by Blue Dog - Jun-25-2017, 02:03 PM
RE: Response [200] little help - by Larz60+ - Jun-25-2017, 03:47 PM
RE: Response [200] little help - by Blue Dog - Jun-25-2017, 05:22 PM
RE: Response [200] little help - by Larz60+ - Jun-25-2017, 06:22 PM
RE: Response [200] little help - by DeaD_EyE - Jun-25-2017, 09:18 PM
RE: Response [200] little help - by Blue Dog - Jun-27-2017, 01:57 AM
RE: Response [200] little help - by nilamo - Jul-11-2017, 06:13 PM
RE: Response [200] little help - by DeaD_EyE - Jul-11-2017, 06:40 PM
RE: Response [200] little help - by nilamo - Jul-11-2017, 06:42 PM

Forum Jump:

User Panel Messages

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