Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: [Python] Damn URLError!

  1. #1

    Joined
    Jan 2012
    Posts
    96
    Userbars
    1
    Thanks
    4
    Thanked
    10/8
    DL/UL
    26/0
    Mentioned
    16 times
    Time Online
    8h 17m
    Avg. Time Online
    N/A

    [Python] Damn URLError!

    I've totally finished writing a Cliffhanger AP. Totally. The last thing that I put together was the post request to submit my answer to the question and I always get the same error!

    Code:
    Traceback (most recent call last):
      File "C:\Python27\Doc\Neopets\CliffHangerAP.py", line 157, in <module>
        clif = opener.open(request)
      File "C:\Python27\lib\urllib2.py", line 392, in open
        req = meth(req)
      File "C:\Python27\lib\urllib2.py", line 1100, in do_request_
        raise URLError('no host given')
    URLError: <urlopen error no host given>
    My code is simply:
    Code:
    clif = opener.open(request)
    The request in one case was:
    Code:
    http://www.neopets.com/games/cliffhanger/process_cliffhanger.phtml?solve_puzzle=There+is+only+one+ryshu+and+there+is+only+one+techo+master
    &submit=I+Know!!!+Let+Me+Solve+The+Puzzle!
    When I copy and paste this exact same request into my browser, it finishes the game without a hitch. What is it about Python alone that is causing this submission to fail?

  2. #2
    Saiyan Race
    j03's Avatar
    Joined
    Dec 2011
    Posts
    13,720
    Userbars
    166
    Thanks
    5,906
    Thanked
    33,076/6,608
    DL/UL
    23/36
    Mentioned
    3,867 times
    Time Online
    563d 4h 55m
    Avg. Time Online
    3h 13m
    Based on the error I think you are missing a host in your wrapper (if you are using one). Is it possible to post some of your code for us to see what you are doing?
    (you need an account to see links)
    (you need an account to see links)(you need an account to see links)

    ------------------------
    [02/24/2013] Stealth CORE is made into the first standalone Neopets auto-player.
    ------------------------


  3. #3

    Joined
    Jan 2012
    Posts
    96
    Userbars
    1
    Thanks
    4
    Thanked
    10/8
    DL/UL
    26/0
    Mentioned
    16 times
    Time Online
    8h 17m
    Avg. Time Online
    N/A
    Quote Originally Posted by Infamous Joe View Post
    Based on the error I think you are missing a host in your wrapper (if you are using one). Is it possible to post some of your code for us to see what you are doing?
    I'm actually not using a wrapper. The only code before that is determining what saying is required to win the game.

  4. #4

    Joined
    Dec 2011
    Posts
    262
    Thanks
    22
    Thanked
    106/68
    DL/UL
    22/0
    Mentioned
    74 times
    Time Online
    N/A
    Avg. Time Online
    N/A
    Does it need a referrer in the request?

  5. #5

    Joined
    Jan 2012
    Posts
    96
    Userbars
    1
    Thanks
    4
    Thanked
    10/8
    DL/UL
    26/0
    Mentioned
    16 times
    Time Online
    8h 17m
    Avg. Time Online
    N/A
    Quote Originally Posted by Josh View Post
    Does it need a referrer in the request?
    Nope, as I said before it could completed just fine in the browser. Unless I misunderstand what referrer means.
    Last edited by Neoquest; 02-04-2012 at 03:44 PM.

  6. #6

    Joined
    Dec 2011
    Posts
    488
    Thanks
    303
    Thanked
    559/263
    DL/UL
    13/4
    Mentioned
    34 times
    Time Online
    1h 58m
    Avg. Time Online
    N/A
    Referrer is an HTTP header that is sent when you send data through a browser, usually says what the page you came from is

  7. #7

    Joined
    Jan 2012
    Posts
    96
    Userbars
    1
    Thanks
    4
    Thanked
    10/8
    DL/UL
    26/0
    Mentioned
    16 times
    Time Online
    8h 17m
    Avg. Time Online
    N/A
    Yeah, that was my understanding of it. I don't really think that's the issue though, considering I can be on any page I want when sending the request from in a browser, and I'm on the correct page with the program.

  8. #8
    Reemer's Avatar
    Joined
    Dec 2011
    Posts
    639
    Userbars
    8
    Thanks
    364
    Thanked
    446/256
    DL/UL
    39/0
    Mentioned
    203 times
    Time Online
    4d 13h 47m
    Avg. Time Online
    1m
    Try a GET instead of POST. That happened to me one time

  9. #9

    Joined
    Jan 2012
    Posts
    96
    Userbars
    1
    Thanks
    4
    Thanked
    10/8
    DL/UL
    26/0
    Mentioned
    16 times
    Time Online
    8h 17m
    Avg. Time Online
    N/A
    Hm, this is really weird. When I use my Cliffhanger AP to generate the request and then execute it in a different program it goes off without a hitch.

    Quote Originally Posted by Reemer View Post
    Try a GET instead of POST. That happened to me one time
    Didn't work. Why would that work though? The form asks for a POST.
    Last edited by Neoquest; 02-04-2012 at 06:34 PM.

  10. #10
    Reemer's Avatar
    Joined
    Dec 2011
    Posts
    639
    Userbars
    8
    Thanks
    364
    Thanked
    446/256
    DL/UL
    39/0
    Mentioned
    203 times
    Time Online
    4d 13h 47m
    Avg. Time Online
    1m
    For my Subeta autoquesters HTTP Live Headers and Tamper Data both said it was a POST, and after hours of frustration I changed it to a GET and it worked.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •