From 6061d30617850becd86691caf53e8bd9df88fe57 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 1 Aug 2016 16:18:11 +0200 Subject: [PATCH] modified version --- README.rst | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 2 +- 2 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 README.rst diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..5c8d4b3 --- /dev/null +++ b/README.rst @@ -0,0 +1,125 @@ +keepaAPI +======== + +Python module to interface to https://keepa.com/ to query for Amazon +product information and history. + +Requirements +------------ + +Module is compatible with Python 2 and 3. keepaAPI requires: + numpy + +requests + +Product history can be plotted from the raw data when matplotlib is +installed. + +Additionally, interfacing with the keepaAPI requires an accesskey and +monthly subscription from https://keepa.com/#!api + +Installation +------------ + +Module can be installed from PyPi using ``pip install keepaAPI`` + +Source code can also be downloaded from this github repository and +installed using ``python setup.py install`` or ``pip install .`` + +Brief Example +------------- + +.. code:: python + + from keepaAPI import Interface + accesskey = 'XXXXXXXXXXXXXXXX' # enter real access key here + api = Interface.API(accesskey) + + #Single ASIN query + products = api.ProductQuery('059035342X') # returns list of product data + +Detailed Example +---------------- + +Import interface and establish connection to server + +.. code:: python + + from keepaAPI import Interface + accesskey = 'XXXXXXXXXXXXXXXX' # enter real access key here + api = Interface.API(accesskey) + +Single ASIN query + +.. code:: python + + products = api.ProductQuery('059035342X') + + # See help(api.ProductQuery) for available options when querying the API + +Multiple ASIN query from List + +.. code:: python + + asins = ['0022841350', '0022841369', '0022841369', '0022841369'] + products = api.ProductQuery(asins) + +Multiple ASIN query from numpy array + +.. code:: python + + asins = np.asarray(['0022841350', '0022841369', '0022841369', '0022841369']) + products = api.ProductQuery(asins) + +Products is a list of product data with one entry per successful result +from the keepa server. Each entry is a dictionary containing the same +product data available from http://www.amazon.com. + +.. code:: python + + + # Available keys + print(products[0].keys()) + + # Print ASIN and title + print('ASIN is ' + products[0]['asin']) + print('Title is ' + products[0]['title']) + +The raw data is contained within each product result. Raw data is stored +as a dictonary with each key paired with its associated time history. + +.. code:: python + + # Access new price history and associated time data + newprice = products[0]['data']['MarketplaceNew'] + newpricetime = products[0]['data']['MarketplaceNew_time'] + + # Can be plotted with matplotlib using: + import matplotlib.pyplot as plt + plt.step(newpricetime, newprice, where='pre') + + # Keys can be listed by + print(products[0]['data'].keys()) + +The product history can also be plotted from the module if matplotlib is +installed + +.. code:: python + + Plotting.PlotProduct(products[0]) + +History +------- + +1 August 2016: Initial commit + +Credits +------- + +This python code, written by Alex Kaszynski, is based on Java code +writen by Marius Johann, CEO keepa. Java source is can be found at +https://github.com/keepacom/api_backend/ + +License +------- + +See license file. Work is credited to both Alex Kaszynski and Marius +Johann. diff --git a/setup.py b/setup.py index 501eb78..8b7e92c 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ packages = ['keepaAPI'], # Version - version='0.10.2', + version='0.10.0', description='Interfaces with keepa.com', long_description=open('README.rst').read(),