Results 1 to 3 of 3

Thread: [Python] Main Shop AB - Send Haggle POST Data?

  1. #1
    Neoquest's Avatar
    Join Date
    Jan 2012
    Gender
    Posts
    97
    Thanks
    4
    Thanked 10 Times in 8 Posts


    Downloads
    26
    Uploads
    0
    Mentioned
    16 Post(s)
    Time Online
    8 h 17 m
    Avg. Time Online
    N/A
    Rep Power
    6

    [Python] Main Shop AB - Send Haggle POST Data?

    For the past few days I've been writing a MSAB, and it's nearly done. (OCR, formatting haggle, getting to haggle page, all done.) But when I try to actually send the POST data on the haggle page, it just stays on the haggle page. An example of my code:



    The first link is just OCR and the price. The variable "link" is where I think I'm doing something wrong. (Setting the referrer) Note that link is scraped from the mainshop page when the item restocks, and it isn't always that. The resulting page source ("buying") doesn't even say that I failed to click the pet correctly, or that my haggle was rejected, it is equivalent to a refresh of the page.

  2. #2
    Banned
    Join Date
    Dec 2011
    Gender
    Age
    25
    Posts
    490
    Thanks
    304
    Thanked 549 Times in 260 Posts


    Downloads
    13
    Uploads
    4
    Mentioned
    34 Post(s)
    Time Online
    1 h 58 m
    Avg. Time Online
    N/A
    Rep Power
    0
    It appears from the code I see you are trying to use a GET request, not a POST request.

    http://docs.python.org/library/urlli...rllib2.Request



    urllib2 works in this way: if there is no data parameter, send it as a GET request. If there is a data parameter, sent a POST request. I'd also make sure you're setting the user-agent in the headers to FF or something, since the default user-agent is Python-Urllib (or something similiar), which is obviously not a browser.

  3. The Following User Says Thank You to Miguel For This Useful Post:

    Neoquest (03-11-2012)

  4. #3
    Neoquest's Avatar
    Join Date
    Jan 2012
    Gender
    Posts
    97
    Thanks
    4
    Thanked 10 Times in 8 Posts


    Downloads
    26
    Uploads
    0
    Mentioned
    16 Post(s)
    Time Online
    8 h 17 m
    Avg. Time Online
    N/A
    Rep Power
    6
    Quote Originally Posted by ./m View Post
    It appears from the code I see you are trying to use a GET request, not a POST request.

    http://docs.python.org/library/urlli...rllib2.Request



    urllib2 works in this way: if there is no data parameter, send it as a GET request. If there is a data parameter, sent a POST request. I'd also make sure you're setting the user-agent in the headers to FF or something, since the default user-agent is Python-Urllib (or something similiar), which is obviously not a browser.
    Don't worry, the headers are set to FF, and thanks, I'll try adding in the data.

    ---------- Post added at 06:26 PM ---------- Previous post was at 06:10 PM ----------

    That worked! Thanks a ton!

Posting Permissions

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