Have a look at the amazon-orders Python library
. Under the hood it also uses the requests
library, but provides both a CLI and API for you to use to fetch data from your account related to Order and Transaction history.
You didn't share much code, but from your description, it sounds like what you're missing is persisting cookies between requests, which requests
can do when you use a Session
(here's how we do that in amazon-orders
). Specifically the session-token
and x-main
cookies are the best identifiers I've found to indicate successful authentication, but you need to carry all cookies returned forward in every subsequent request (which the Session
will do for you automatically).
If you're looking to parse data from product pages, the amazon-orders
library won't do that for you, but you could still have a look at it (especially with regards to how authentication is done) to see how authenticated scraping of Amazon can be done. Full disclosure, I am the original developer of it.