jeudi 24 décembre 2015

submitting advanced ebay searches with python

I know there's an api among other things for scraping ebay but all I need is to submit advanced searches. So, I made a function to do this, (hardcoded for now) but there's one thing I cannot get to work. It's marking items as new. From inspecting the element on their form when items are marked as 'New' in the advanced search form the other two fields get marked as 'disabled' and that's the only changes I could see.

I'm submitting the form as below and writing the content to a file so I can open it up to see the result. Everything works fine and I can open the webpage and it's the correct results, but the 'New' option is not selected.

What is the correct way to submit this selection? I've tried lots of variations and nothing I've tried works.

def submit_advanced_search():

    params = {
        '_nkw': "",
        '_in_kw': 1,
        '_ex_kw': "",
        '_sacat': 20081,
        'LH_Sold': 1,
        '_udlo': 20,
        '_udhi': 250,
        'LH_ItemConditionUsed': {'disabled':'disabled'},
        'LH_ItemConditionNS': {'disabled':'disabled'},
        'LH_BIN': 1,
        'LH_FS': 1,
        'LH_Complete': 1,
    }

    content = requests.get("http://ift.tt/1pQBXiR", params = params).content
    with open("requests_result.html", "wb") as f:
        f.write(content)




Aucun commentaire:

Enregistrer un commentaire