{"id":13586748,"url":"https://github.com/akaszynski/keepa","last_synced_at":"2026-01-06T02:18:46.159Z","repository":{"id":41086476,"uuid":"64647984","full_name":"akaszynski/keepa","owner":"akaszynski","description":"Python Keepa.com API  ","archived":false,"fork":false,"pushed_at":"2024-05-06T20:28:18.000Z","size":410,"stargazers_count":221,"open_issues_count":11,"forks_count":73,"subscribers_count":20,"default_branch":"main","last_synced_at":"2024-05-06T21:35:58.721Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://keepaapi.readthedocs.io/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/akaszynski.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-01T08:02:37.000Z","updated_at":"2024-05-27T23:59:13.277Z","dependencies_parsed_at":"2023-02-09T05:02:33.797Z","dependency_job_id":"d5d5aaa4-51c7-45ab-82b5-dc6a95596a34","html_url":"https://github.com/akaszynski/keepa","commit_stats":{"total_commits":153,"total_committers":11,"mean_commits":"13.909090909090908","dds":"0.11111111111111116","last_synced_commit":"8ec22919c3d8b025fda977e9a4f86e4816ae851f"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akaszynski%2Fkeepa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akaszynski%2Fkeepa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akaszynski%2Fkeepa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akaszynski%2Fkeepa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akaszynski","download_url":"https://codeload.github.com/akaszynski/keepa/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248615946,"owners_count":21133983,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T15:05:47.021Z","updated_at":"2026-01-06T02:18:46.153Z","avatar_url":"https://github.com/akaszynski.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"Python keepa Client Library\n===========================\n\n.. image:: https://img.shields.io/pypi/v/keepa.svg?logo=python\u0026logoColor=white\n   :target: https://pypi.org/project/keepa/\n\n.. image:: https://github.com/akaszynski/keepa/actions/workflows/testing-and-deployment.yml/badge.svg\n    :target: https://github.com/akaszynski/keepa/actions/workflows/testing-and-deployment.yml\n\n.. image:: https://readthedocs.org/projects/keepaapi/badge/?version=latest\n    :target: https://keepaapi.readthedocs.io/en/latest/?badge=latest\n    :alt: Documentation Status\n\n.. image:: https://codecov.io/gh/akaszynski/keepa/branch/main/graph/badge.svg\n  :target: https://codecov.io/gh/akaszynski/keepa\n\n.. image:: https://app.codacy.com/project/badge/Grade/9452f99f297c4a6eac14e2d21189ab6f\n  :target: https://www.codacy.com/gh/akaszynski/keepa/dashboard?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=akaszynski/keepa\u0026amp;utm_campaign=Badge_Grade\n\n\nThis Python library allows you to interface with the API at `Keepa\n\u003chttps://keepa.com/\u003e`_ to query for Amazon product information and\nhistory. It also contains a plotting module to allow for plotting of\na product.\n\nSign up for `Keepa Data Access \u003chttps://get.keepa.com/d7vrq\u003e`_.\n\nDocumentation can be found at `Keepa Documentation \u003chttps://keepaapi.readthedocs.io\u003e`_.\n\n\nRequirements\n------------\nThis library is compatible with Python \u003e= 3.10 and requires:\n\n- ``numpy``\n- ``aiohttp``\n- ``matplotlib``\n- ``tqdm``\n\nProduct history can be plotted from the raw data when ``matplotlib``\nis installed.\n\nInterfacing with the ``keepa`` requires an access key and a monthly\nsubscription from `Keepa API \u003chttps://keepa.com/#!api\u003e`_.\n\nInstallation\n------------\nModule can be installed from `PyPi \u003chttps://pypi.org/project/keepa/\u003e`_ with:\n\n.. code::\n\n    pip install keepa\n\n\nSource code can also be downloaded from `GitHub\n\u003chttps://github.com/akaszynski/keepa\u003e`_ and installed using::\n\n  cd keepa\n  pip install .\n\n\nBrief Example\n-------------\n.. code:: python\n\n    import keepa\n    accesskey = 'XXXXXXXXXXXXXXXX' # enter real access key here from https://get.keepa.com/d7vrq\n    api = keepa.Keepa(accesskey)\n\n    # Single ASIN query\n    products = api.query('B0088PUEPK')  # returns list of product data\n\n    # Plot result (requires matplotlib)\n    keepa.plot_product(products[0])\n\n.. figure:: https://github.com/akaszynski/keepa/raw/main/docs/source/images/Product_Price_Plot.png\n    :width: 500pt\n\n    Product Price Plot\n\n.. figure:: https://github.com/akaszynski/keepa/raw/main/docs/source/images/Product_Offer_Plot.png\n    :width: 500pt\n\n    Product Offers Plot\n\n\nBrief Example using async\n-------------------------\nHere's an example of obtaining a product and plotting its price and\noffer history using the ``keepa.AsyncKeepa`` class:\n\n.. code:: python\n\n    \u003e\u003e\u003e import asyncio\n    \u003e\u003e\u003e import keepa\n    \u003e\u003e\u003e product_parms = {'author': 'jim butcher'}\n    \u003e\u003e\u003e async def main():\n    ...     key = '\u003cREAL_KEEPA_KEY\u003e'\n    ...     api = await keepa.AsyncKeepa().create(key)\n    ...     return await api.product_finder(product_parms)\n    \u003e\u003e\u003e asins = asyncio.run(main())\n    \u003e\u003e\u003e asins\n    ['B000HRMAR2',\n     '0578799790',\n     'B07PW1SVHM',\n    ...\n     'B003MXM744',\n     '0133235750',\n     'B01MXXLJPZ']\n\nQuery for product with ASIN ``'B0088PUEPK'`` using the asynchronous\nkeepa interface.\n\n.. code:: python\n\n    \u003e\u003e\u003e import asyncio\n    \u003e\u003e\u003e import keepa\n    \u003e\u003e\u003e async def main():\n    ...     key = '\u003cREAL_KEEPA_KEY\u003e'\n    ...     api = await keepa.AsyncKeepa().create(key)\n    ...     return await api.query('B0088PUEPK')\n    \u003e\u003e\u003e response = asyncio.run(main())\n    \u003e\u003e\u003e response[0]['title']\n    'Western Digital 1TB WD Blue PC Internal Hard Drive HDD - 7200 RPM,\n    SATA 6 Gb/s, 64 MB Cache, 3.5\" - WD10EZEX'\n\n\nDetailed Examples\n-----------------\nImport interface and establish connection to server\n\n.. code:: python\n\n    import keepa\n    accesskey = 'XXXXXXXXXXXXXXXX' # enter real access key here\n    api = keepa.Keepa(accesskey)\n\n\nSingle ASIN query\n\n.. code:: python\n\n    products = api.query('059035342X')\n\n    # See help(api.query) for available options when querying the API\n\n\nYou can use keepa witch async / await too\n\n.. code:: python\n\n    import keepa\n    accesskey = 'XXXXXXXXXXXXXXXX' # enter real access key here\n    api = await keepa.AsyncKeepa.create(accesskey)\n\n\nSingle ASIN query (async)\n\n.. code:: python\n\n    products = await api.query('059035342X')\n\n\nMultiple ASIN query from List\n\n.. code:: python\n\n    asins = ['0022841350', '0022841369', '0022841369', '0022841369']\n    products = api.query(asins)\n\nMultiple ASIN query from numpy array\n\n.. code:: python\n\n    asins = np.asarray(['0022841350', '0022841369', '0022841369', '0022841369'])\n    products = api.query(asins)\n\nProducts 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 `Amazon \u003chttp://www.amazon.com\u003e`_.\n\n.. code:: python\n\n    # Available keys\n    print(products[0].keys())\n\n    # Print ASIN and title\n    print('ASIN is ' + products[0]['asin'])\n    print('Title is ' + products[0]['title'])\n\nThe raw data is contained within each product result. Raw data is stored as a dictionary with each key paired with its associated time history.\n\n.. code:: python\n\n    # Access new price history and associated time data\n    newprice = products[0]['data']['NEW']\n    newpricetime = products[0]['data']['NEW_time']\n\n    # Can be plotted with matplotlib using:\n    import matplotlib.pyplot as plt\n    plt.step(newpricetime, newprice, where='pre')\n\n    # Keys can be listed by\n    print(products[0]['data'].keys())\n\nThe product history can also be plotted from the module if ``matplotlib`` is installed\n\n.. code:: python\n\n    keepa.plot_product(products[0])\n\nYou can obtain the offers history for an ASIN (or multiple ASINs) using the ``offers`` parameter.  See the documentation at `Request Products \u003chttps://keepa.com/#!discuss/t/request-products/110/1\u003e`_ for further details.\n\n.. code:: python\n\n    products = api.query(asins, offers=20)\n    product = products[0]\n    offers = product['offers']\n\n    # each offer contains the price history of each offer\n    offer = offers[0]\n    csv = offer['offerCSV']\n\n    # convert these values to numpy arrays\n    times, prices = keepa.convert_offer_history(csv)\n\n    # for a list of active offers, see\n    indices = product['liveOffersOrder']\n\n    # with this you can loop through active offers:\n    indices = product['liveOffersOrder']\n    offer_times = []\n    offer_prices = []\n    for index in indices:\n        csv = offers[index]['offerCSV']\n        times, prices = keepa.convert_offer_history(csv)\n        offer_times.append(times)\n        offer_prices.append(prices)\n\n    # you can aggregate these using np.hstack or plot at the history individually\n    import matplotlib.pyplot as plt\n    for i in range(len(offer_prices)):\n        plt.step(offer_times[i], offer_prices[i])\n    plt.show()\n\nIf you plan to do a lot of simulatneous query, you might want to speedup query using\n``wait=False`` arguments.\n\n.. code:: python\n\n    products = await api.query('059035342X', wait=False)\n\n\nBuy Box Statistics\n~~~~~~~~~~~~~~~~~~\nTo load used buy box statistics, you have to enable ``offers``. This example\nloads in product offers and converts the buy box data into a\n``pandas.DataFrame``.\n\n.. code:: pycon\n\n    \u003e\u003e\u003e import keepa\n    \u003e\u003e\u003e key = '\u003cREAL_KEEPA_KEY\u003e'\n    \u003e\u003e\u003e api = keepa.Keepa(key)\n    \u003e\u003e\u003e response = api.query('B0088PUEPK', offers=20)\n    \u003e\u003e\u003e product = response[0]\n    \u003e\u003e\u003e buybox_info = product['buyBoxUsedHistory']\n    \u003e\u003e\u003e df = keepa.process_used_buybox(buybox_info)\n                   datetime         user_id         condition  isFBA\n    0   2022-11-02 16:46:00  A1QUAC68EAM09F   Used - Like New   True\n    1   2022-11-13 10:36:00  A18WXU4I7YR6UA  Used - Very Good  False\n    2   2022-11-15 23:50:00   AYUGEV9WZ4X5O   Used - Like New  False\n    3   2022-11-17 06:16:00  A18WXU4I7YR6UA  Used - Very Good  False\n    4   2022-11-17 10:56:00   AYUGEV9WZ4X5O   Used - Like New  False\n    ..                  ...             ...               ...    ...\n    115 2023-10-23 10:00:00   AYUGEV9WZ4X5O   Used - Like New  False\n    116 2023-10-25 21:14:00  A1U9HDFCZO1A84   Used - Like New  False\n    117 2023-10-26 04:08:00   AYUGEV9WZ4X5O   Used - Like New  False\n    118 2023-10-27 08:14:00  A1U9HDFCZO1A84   Used - Like New  False\n    119 2023-10-27 12:34:00   AYUGEV9WZ4X5O   Used - Like New  False\n\nContributing\n------------\nContribute to this repository by forking this repository and installing in\ndevelopment mode with::\n\n  git clone https://github.com/\u003cUSERNAME\u003e/keepa\n  pip install -e .[test]\n\nYou can then add your feature or commit your bug fix and then run your unit\ntesting with::\n\n  pytest\n\nUnit testing will automatically enforce minimum code coverage standards.\n\nNext, to ensure your code meets minimum code styling standards, run::\n\n  pre-commit run --all-files\n\nFinally, `create a pull request`_ from your fork and I'll be sure to review it.\n\n\nCredits\n-------\nThis Python module, written by Alex Kaszynski and several contribitors, is\nbased on Java code written by Marius Johann, CEO Keepa. Java source is can be\nfound at `keepacom/api_backend \u003chttps://github.com/keepacom/api_backend/\u003e`_.\n\n\nLicense\n-------\nApache License, please see license file. Work is credited to both Alex Kaszynski\nand Marius Johann.\n\n\n.. _create a pull request: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakaszynski%2Fkeepa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakaszynski%2Fkeepa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakaszynski%2Fkeepa/lists"}