I am trying to create an application that:
Logs into the Amazon Seller Central
Opens up several pages contained within, retrieves the rendered page source including values that were populated by javascript
Parses that rendered page source and outputs a report for the user. (This part is complete)
I have been able to manually complete this task by using the firefox addon firebug to view the rendered page source, copying that to a file and I have finished writing the parser. However, I want to automate this process and make it as user friendly as possible to share with individuals who may not be very technically savvy.
My difficulty has been in completing steps 1 and 2 using Python. I have been doing a lot of searching and reading about using the libraries urllib, urllib2, and cookielib, but I haven't been able to figure out how to get it working properly.
For example I found this snippet here on stackoverflow:
import urllib, urllib2, cookielib
username = "xxx"
password = "xxx"
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
login_data = urllib.urlencode({'username':username,'j_password':password})
opener.open('https://sellercentral.amazon.com/gp/homepage.html', login_data)
resp = opener.open('https://sellercentral.amazon.com/myi/search /ItemSummary.amzn?')
print resp.read()
Now, I know that my opener.open is wrong, but I don't know where I can find the Amazon seller central login script that I need to point this at.
Also, I am not sure if I am going about this in the right way. Any direction is greatly appreciated.