Results 1 to 10 of 10

Thread: [Python] POST Error

  1. #1



    Ghosts's Avatar
    Joined
    Jul 2013
    Posts
    1,527
    Userbars
    9
    Thanks
    957
    Thanked
    981/359
    DL/UL
    81/3
    Mentioned
    451 times
    Time Online
    187d 15h 9m
    Avg. Time Online
    1h 8m

    [Python] POST Error

    Been running into an issue with a script I'm working on, can't seem to figure it out. It should be accepting items, but it doesn't look like the POST request is actually doing anything.

    Code:
    itemnames = []
    postdata = {}
    
    html = acc.get("http://www.neopets.com/items/transfer_list.phtml")
    
    startpos = 0
    while html.find("'><br><b>", startpos) != -1:
        pos1 = html.find("'><br><b>", startpos) + 9
        pos2 = html.find("<", pos1) - 1
        pos3 = html.find("input type='radio' name='", pos2) + 25
        pos4 = html.find("'", pos3)
        startpos = pos4
        
        itemid = urllib.quote_plus(html[pos3:pos4])
        postdata[itemid] = "accept"
        itemnames.append(html[pos1:pos2])
        
    html = acc.post("http://www.neopets.com/items/transfer_list.phtml", postdata)
    Printout of what the postdata looks like upon submitting:
    Code:
    {'itemgiven%5B14154130660334%2C191782743%2Crzerox%2Cdylamn%5D': 'accept'}

  2. #2
    Saiyan Race
    j03's Avatar
    Joined
    Dec 2011
    Posts
    13,738
    Userbars
    176
    Thanks
    5,926
    Thanked
    33,147/6,615
    DL/UL
    23/36
    Mentioned
    3,871 times
    Time Online
    564d 1h 53m
    Avg. Time Online
    3h 13m
    Do you have the right referer being sent?
    (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



    Ghosts's Avatar
    Joined
    Jul 2013
    Posts
    1,527
    Userbars
    9
    Thanks
    957
    Thanked
    981/359
    DL/UL
    81/3
    Mentioned
    451 times
    Time Online
    187d 15h 9m
    Avg. Time Online
    1h 8m
    Quote Originally Posted by Infamous Joe View Post
    Do you have the right referer being sent?
    I should, I have tried both of these, though I'd assume either would work.
    (you need an account to see links)
    (you need an account to see links)

    I'm posting to 'http://www.neopets.com/items/transfer_list.phtml' as well, since that's what the form action is set as.

    Code:
    <form name='transfer_form' action='/items/transfer_list.phtml' method='post'>

  4. #4
    Zachafer's Avatar
    Joined
    Dec 2011
    Posts
    1,235
    Userbars
    11
    Thanks
    769
    Thanked
    1,466/678
    DL/UL
    98/0
    Mentioned
    512 times
    Time Online
    24d 13h 9m
    Avg. Time Online
    8m
    Is there an error? Try sending the Referrer field

  5. #5



    Ghosts's Avatar
    Joined
    Jul 2013
    Posts
    1,527
    Userbars
    9
    Thanks
    957
    Thanked
    981/359
    DL/UL
    81/3
    Mentioned
    451 times
    Time Online
    187d 15h 9m
    Avg. Time Online
    1h 8m
    Quote Originally Posted by Zachafer View Post
    Is there an error? Try sending the Referrer field
    No error, just doesn't do anything. I've tried that too.

  6. #6
    Zachafer's Avatar
    Joined
    Dec 2011
    Posts
    1,235
    Userbars
    11
    Thanks
    769
    Thanked
    1,466/678
    DL/UL
    98/0
    Mentioned
    512 times
    Time Online
    24d 13h 9m
    Avg. Time Online
    8m
    Try posting to (you need an account to see links) so you can see what the HTTP request looks like.

  7. #7



    Ghosts's Avatar
    Joined
    Jul 2013
    Posts
    1,527
    Userbars
    9
    Thanks
    957
    Thanked
    981/359
    DL/UL
    81/3
    Mentioned
    451 times
    Time Online
    187d 15h 9m
    Avg. Time Online
    1h 8m
    Done @(you need an account to see links)

    {
    "args": {},
    "data": "",
    "files": {},
    "form": {
    "itemgiven%5B14154130660334%2C191782743%2Crzerox%2 Cdylamn%5D": "accept",
    "itemgiven%5B14154633856655%2C191790778%2Crzerox%2 Cabril_1999__83%5D": "accept"
    },
    "headers": {
    "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
    "Accept-Encoding": "gzip, deflate",
    "Accept-Language": "en-us,en;q=0.5",
    "Connect-Time": "1",
    "Connection": "close",
    "Content-Length": "161",
    "Content-Type": "application/x-www-form-urlencoded",
    "Host": "httpbin.org",
    "Referer": "http://www.neopets.com/items/transfer_list.phtml",
    "Total-Route-Time": "0",
    "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0.1",
    "Via": "1.1 vegur",
    "X-Request-Id": "a5d04a92-0864-4b3a-945d-0be203b56386"
    },
    "json": null,
    "origin": "184.75.218.9",
    "url": "http://httpbin.org/post"
    }


    Edit: not sure why it's showing a space in the formdata, that doesn't show up in the shell.
    Last edited by Ghosts; 11-09-2014 at 07:55 PM.

  8. #8

    Joined
    Jun 2012
    Posts
    1,699
    Thanks
    876
    Thanked
    2,881/1,142
    DL/UL
    44/1
    Mentioned
    562 times
    Time Online
    118d 6h 45m
    Avg. Time Online
    40m
    if u pm me contents of the html string after the get ill find the bug :p.

  9. #9
    Zachafer's Avatar
    Joined
    Dec 2011
    Posts
    1,235
    Userbars
    11
    Thanks
    769
    Thanked
    1,466/678
    DL/UL
    98/0
    Mentioned
    512 times
    Time Online
    24d 13h 9m
    Avg. Time Online
    8m
    Quote Originally Posted by Ghosts View Post
    Done @(you need an account to see links)

    Edit: not sure why it's showing a space in the formdata, that doesn't show up in the shell.
    The space is vBulletin. It's not your code (if you edit your post, your code will not have a space)

  10. #10

    Joined
    Jun 2012
    Posts
    1,699
    Thanks
    876
    Thanked
    2,881/1,142
    DL/UL
    44/1
    Mentioned
    562 times
    Time Online
    118d 6h 45m
    Avg. Time Online
    40m
    Not sure why its failing tbh an u send me a account with gifts on? Everything looks like its working but for some reason its just not processing , probably something small. If you dont wanna do that , try charles proxy and set your browsers proxy to localhost:8888 then do the same in ur script and compare the request.

Posting Permissions

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