Python library to grab your Amazon wishlist so you can mess with it programmatically.
Wishlist depends on Brow in order to login from the command line (including 2 factor if enabled), and Brow depends on Selenium and Firefox to be installed, so you'll need to read Brow's README if you need help installing those on Linux.
Nothing special, pip install wishlist
should cover you, jump down to "Commandline wishlist access" and get started.
Is your wishlist private? Then you will need to authenticate on the command line:
$ wishlist auth
This will prompt you to signin and will even handle 2-factor authentication, after you signin your cookies will be saved so you can access your Amazon wishlist on the command line.
You can check access to your wishlist on the command line by running:
$ wishlist dump NAME
where NAME
is the part of a url like https://www.amazon.com/gp/registry/wishlist/NAME
, so, if your wishlist was found at: https://www.amazon.com/gp/registry/wishlist/9YDNFG31NSSRL
then you would run:
$ wishlist dump 9YDNFG31NSSRL
If you wanted to do something in another python script, you can do:
from wishlist.core import Wishlist
name = "9YDNFG31NSSRL"
w = Wishlist(name)
for item in w:
print(item.jsonable())
You can check the wishlist.core.WishlistElement code to understand the structure of each wishlist item.
use pip:
$ pip install wishlist
To get the bleeding edge version:
$ pip install --upgrade "git+https://github.com/Jaymon/wishlist#egg=wishlist"
To change Amazon region from the default (amazon.com) to another (e.g. amazon.co.uk) just set the environment variable WISHLIST_HOST, for example:
export WISHLIST_HOST=https://amazon.co.uk
The environment is setup at module import, so if you need to modify the environment during runtime you should use wishlist.environ
, so to set the host at runtime, you could do something like:
from wishlist.core import Wishlist
from wishlist import environ
environ.HOST="https://www.amazon.fr"
-
Why are you using Firefox for logging in? Why not Chrome? I tried to get it to work in headless Chrome but all the features I needed to work out authentication on the command line weren't supported.
-
Would you rather use php? There's a library for that (also related).
-
Amazon's advertising api is where the officially supported wishlist api used to live.