WIOpy


NameWIOpy JSON
Version 1.1.0 PyPI version JSON
download
home_page
SummaryA Python wrapper for the Walmart IO API
upload_time2024-01-08 02:31:44
maintainer
docs_urlNone
authorCoderJoshDK
requires_python>=3.8
licenseMIT License Copyright (c) 2022 CoderJoshDK Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords aiohttp api affiliate async walmart walmartio wrapper
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![Python](https://img.shields.io/badge/Python->=3.8-%23FFD140)](https://www.python.org/)
[![PyPI](https://img.shields.io/pypi/v/WIOpy)](https://pypi.org/project/WIOpy/)
[![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/CoderJoshDK/WIOpy?include_prereleases)](https://github.com/CoderJoshDK/WIOpy) [![GitHub issues](https://img.shields.io/github/issues/CoderJoshDK/WIOpy)](https://github.com/CoderJoshDK/WIOpy/issues)
[![GitHub Repo stars](https://img.shields.io/github/stars/CoderJoshDK/WIOpy?style=social)](https://github.com/CoderJoshDK/WIOpy)

# WalmartIO Python Wrapper - WIOpy

A python wrapper for the Walmart io API. Only supports the Affiliate API for now. The project is open to contributions

## Getting it

To download WIOpy, either fork this github repo or simply use Pypi via pip.

```sh
pip install WIOpy
```

To upgrade the package simply run  

```sh
pip install WIOpy --upgrade
```

## How to use  

An example of creating a WIOpy connection
One important note is that you need to pass in the private key file *path*.  

```py
from wiopy import WalmartIO
walmart_io = WalmartIO(
    private_key_version="1",
    private_key_filename="./WM_IO_private_key.pem",
    consumer_id='XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
    publisherId="XXXXXXX",
)
data = walmart_io.product_lookup('33093101')[0]
```

WIOpy also supports asynchronous calls. To use, everything will be the same but you must await a call and the constructed object is different.

```py
from wiopy import AsyncWalmartIO
async_walmart_io = AsyncWalmartIO(...)
data = await async_walmart_io.product_lookup('33093101')[0]
```

## Response Examples

When making a call to the API, an object will be returned. That object is an object version of returned JSON.  
There are two ways to get info from the object:

- `data.name`  
- `data['name']`  
An example of a returned object and one that is not (review/search are variables returned):
- `review.reviewStatistics.averageOverallRating` # Nested call
- `search.facets` # Gives back a dict that can now be used like a dict and not object  
Some attributes will return a dict and not an object due to a lack of documentation from Walmart.  
When getting an attribute from a `WalmartResponse`, it will return either `response` or `None`\. But trying to get an attribute of `None` will still raise an error.
[Extra details on calls and responses](walmart.io/docs). However, the docs are inconsistent and lack typical practices such as response schema. That is why something like the search facets response is missing because the docs show it is in the response but not what type of data it will contain.  
While there may be a response missing or a response not being converted to an object, please check [WalmartResponse](./wiopy/WalmartResponse.py) to get an idea of what a response will return. Some properties are not always present in a response.  

## Examples of calls

### [Catalog Product](https://walmart.io/docs/affiliate/paginated-items)

Catalog Product API allows a developer to retrieve the products catalog in a paginated fashion. Catalog can be filtered by category, brand and/or any special offers like rollback, clearance etc.

```py
data = walmart_io.catalog_product(category='3944', maxId='8342714')
```

A catalog response contains category, format, nextPage, totalPages, and a list of items

### [Post Browsed Products](https://walmart.io/docs/affiliate/post-browsed-products)

The post browsed products API allows you to recommend products to someone based on their product viewing history.

```py
data = walmart_io.post_browsed_products('54518466')
```

Response gives top 10 relevant items to the given id

### [Product lookup](https://walmart.io/docs/affiliate/product-lookup)

There are two ways to lookup a product
The first is to pass a single string in

```py
data = walmart_io.product_lookup('33093101')[0]
```

or you can pass a list of strings

```py
data = walmart_io.product_lookup('33093101, 54518466, 516833054')
data = walmart_io.product_lookup(['33093101', '54518466', '516833054'])
```

Remember: product_lookup always returns a list of [WalmartProducts](https://walmart.io/docs/affiliate/item_response_groups)  

### [Bulk product lookup](https://walmart.io/docs/affiliate/product-lookup)

`bulk_product_lookup` is similar to `product_lookup` however, the bulk version does not raise errors and it is a generator.  
Items are passed in as chunks of max size 20. If an error occurs on that call, the same call will be retried based on the given amount. If error still occurs, all items will be lost. But the entire call will not be lost.  

```py
data = walmart_io.bulk_product_lookup('33093101, 54518466, 516833054', amount=1, retries=3)
for items in data:
    for item in items:
        print(item)
```

Response gives generator of [WalmartProducts](https://walmart.io/docs/affiliate/item_response_groups)  
If you are unfamiliar with async generators; to properly call the async version:

```py
data = async_walmart_io.bulk_product_lookup('33093101, 54518466, 516833054')
async for items in data:
    ...
```

### [Product Recommendation](https://walmart.io/docs/affiliate/product-recommendation)

Get recommendations based on a given product id

```py
data = walmart_io.product_recommendation('54518466')
```

Response gives a list of related products

### [Reviews](https://walmart.io/docs/affiliate/reviews)

The Reviews API gives you access to the extensive item reviews on Walmart that have been written by the users of Walmart.com

```py
data = walmart_io.reviews('33093101')
```

Response gives review data

### [Search](https://walmart.io/docs/affiliate/search)

Search API allows text search on the Walmart.com catalogue and returns matching items available for sale online.

```py
# Search for tv within electronics and sort by increasing price:
data = walmart_io.search('tv', categoryId='3944', sort='price', order='ascending')
```

You can also add facets to your search

```py
data = walmart_io.search('tv', filter='brand:Samsung')
```

The search response gives back a list of products and some meta data. It returns a `facets` element but there is no detail on the API about what it could return. It is a list of some unknown type

### [Stores](https://walmart.io/docs/affiliate/stores)

The API can return a list of closest stores near a specified location. Either zip code or lon/lat  

```py
data = walmart_io.stores(lat=29.735577, lon=-95.511747)
```

### [Taxonomy](https://walmart.io/docs/affiliate/taxonomy)

The taxonomy service exposes the taxonomy used to categorize items on Walmart.com.  
Details about params is missing from docs

```py
data = walmart_io.taxonomy()
```

### [Trending Items](https://walmart.io/docs/affiliate/trending-items)

The Trending Items API is designed to give the information on what is bestselling on Walmart.com right now.

```py
data = walmart_io.trending()
```

## Logging

WIOpy supports logging via the logging module. Configuration of the logging module can be as simple as:

```py
import logging

logging.basicConfig(level=logging.INFO)
```

-------
![License](https://img.shields.io/github/license/CoderJoshDK/WIOpy)
![GitHub last commit](https://img.shields.io/github/last-commit/CoderJoshDK/WIOpy)

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "WIOpy",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "AIOHTTP,API,Affiliate,Async,Walmart,WalmartIO,Wrapper",
    "author": "CoderJoshDK",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/7a/2f/f6f0f68c4fdc6e3db8ff244dcd1c617ade0c95e4165f7a49c2f248be809f/wiopy-1.1.0.tar.gz",
    "platform": null,
    "description": "[![Python](https://img.shields.io/badge/Python->=3.8-%23FFD140)](https://www.python.org/)\n[![PyPI](https://img.shields.io/pypi/v/WIOpy)](https://pypi.org/project/WIOpy/)\n[![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/CoderJoshDK/WIOpy?include_prereleases)](https://github.com/CoderJoshDK/WIOpy) [![GitHub issues](https://img.shields.io/github/issues/CoderJoshDK/WIOpy)](https://github.com/CoderJoshDK/WIOpy/issues)\n[![GitHub Repo stars](https://img.shields.io/github/stars/CoderJoshDK/WIOpy?style=social)](https://github.com/CoderJoshDK/WIOpy)\n\n# WalmartIO Python Wrapper - WIOpy\n\nA python wrapper for the Walmart io API. Only supports the Affiliate API for now. The project is open to contributions\n\n## Getting it\n\nTo download WIOpy, either fork this github repo or simply use Pypi via pip.\n\n```sh\npip install WIOpy\n```\n\nTo upgrade the package simply run  \n\n```sh\npip install WIOpy --upgrade\n```\n\n## How to use  \n\nAn example of creating a WIOpy connection\nOne important note is that you need to pass in the private key file *path*.  \n\n```py\nfrom wiopy import WalmartIO\nwalmart_io = WalmartIO(\n    private_key_version=\"1\",\n    private_key_filename=\"./WM_IO_private_key.pem\",\n    consumer_id='XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',\n    publisherId=\"XXXXXXX\",\n)\ndata = walmart_io.product_lookup('33093101')[0]\n```\n\nWIOpy also supports asynchronous calls. To use, everything will be the same but you must await a call and the constructed object is different.\n\n```py\nfrom wiopy import AsyncWalmartIO\nasync_walmart_io = AsyncWalmartIO(...)\ndata = await async_walmart_io.product_lookup('33093101')[0]\n```\n\n## Response Examples\n\nWhen making a call to the API, an object will be returned. That object is an object version of returned JSON.  \nThere are two ways to get info from the object:\n\n- `data.name`  \n- `data['name']`  \nAn example of a returned object and one that is not (review/search are variables returned):\n- `review.reviewStatistics.averageOverallRating` # Nested call\n- `search.facets` # Gives back a dict that can now be used like a dict and not object  \nSome attributes will return a dict and not an object due to a lack of documentation from Walmart.  \nWhen getting an attribute from a `WalmartResponse`, it will return either `response` or `None`\\. But trying to get an attribute of `None` will still raise an error.\n[Extra details on calls and responses](walmart.io/docs). However, the docs are inconsistent and lack typical practices such as response schema. That is why something like the search facets response is missing because the docs show it is in the response but not what type of data it will contain.  \nWhile there may be a response missing or a response not being converted to an object, please check [WalmartResponse](./wiopy/WalmartResponse.py) to get an idea of what a response will return. Some properties are not always present in a response.  \n\n## Examples of calls\n\n### [Catalog Product](https://walmart.io/docs/affiliate/paginated-items)\n\nCatalog Product API allows a developer to retrieve the products catalog in a paginated fashion. Catalog can be filtered by category, brand and/or any special offers like rollback, clearance etc.\n\n```py\ndata = walmart_io.catalog_product(category='3944', maxId='8342714')\n```\n\nA catalog response contains category, format, nextPage, totalPages, and a list of items\n\n### [Post Browsed Products](https://walmart.io/docs/affiliate/post-browsed-products)\n\nThe post browsed products API allows you to recommend products to someone based on their product viewing history.\n\n```py\ndata = walmart_io.post_browsed_products('54518466')\n```\n\nResponse gives top 10 relevant items to the given id\n\n### [Product lookup](https://walmart.io/docs/affiliate/product-lookup)\n\nThere are two ways to lookup a product\nThe first is to pass a single string in\n\n```py\ndata = walmart_io.product_lookup('33093101')[0]\n```\n\nor you can pass a list of strings\n\n```py\ndata = walmart_io.product_lookup('33093101, 54518466, 516833054')\ndata = walmart_io.product_lookup(['33093101', '54518466', '516833054'])\n```\n\nRemember: product_lookup always returns a list of [WalmartProducts](https://walmart.io/docs/affiliate/item_response_groups)  \n\n### [Bulk product lookup](https://walmart.io/docs/affiliate/product-lookup)\n\n`bulk_product_lookup` is similar to `product_lookup` however, the bulk version does not raise errors and it is a generator.  \nItems are passed in as chunks of max size 20. If an error occurs on that call, the same call will be retried based on the given amount. If error still occurs, all items will be lost. But the entire call will not be lost.  \n\n```py\ndata = walmart_io.bulk_product_lookup('33093101, 54518466, 516833054', amount=1, retries=3)\nfor items in data:\n    for item in items:\n        print(item)\n```\n\nResponse gives generator of [WalmartProducts](https://walmart.io/docs/affiliate/item_response_groups)  \nIf you are unfamiliar with async generators; to properly call the async version:\n\n```py\ndata = async_walmart_io.bulk_product_lookup('33093101, 54518466, 516833054')\nasync for items in data:\n    ...\n```\n\n### [Product Recommendation](https://walmart.io/docs/affiliate/product-recommendation)\n\nGet recommendations based on a given product id\n\n```py\ndata = walmart_io.product_recommendation('54518466')\n```\n\nResponse gives a list of related products\n\n### [Reviews](https://walmart.io/docs/affiliate/reviews)\n\nThe Reviews API gives you access to the extensive item reviews on Walmart that have been written by the users of Walmart.com\n\n```py\ndata = walmart_io.reviews('33093101')\n```\n\nResponse gives review data\n\n### [Search](https://walmart.io/docs/affiliate/search)\n\nSearch API allows text search on the Walmart.com catalogue and returns matching items available for sale online.\n\n```py\n# Search for tv within electronics and sort by increasing price:\ndata = walmart_io.search('tv', categoryId='3944', sort='price', order='ascending')\n```\n\nYou can also add facets to your search\n\n```py\ndata = walmart_io.search('tv', filter='brand:Samsung')\n```\n\nThe search response gives back a list of products and some meta data. It returns a `facets` element but there is no detail on the API about what it could return. It is a list of some unknown type\n\n### [Stores](https://walmart.io/docs/affiliate/stores)\n\nThe API can return a list of closest stores near a specified location. Either zip code or lon/lat  \n\n```py\ndata = walmart_io.stores(lat=29.735577, lon=-95.511747)\n```\n\n### [Taxonomy](https://walmart.io/docs/affiliate/taxonomy)\n\nThe taxonomy service exposes the taxonomy used to categorize items on Walmart.com.  \nDetails about params is missing from docs\n\n```py\ndata = walmart_io.taxonomy()\n```\n\n### [Trending Items](https://walmart.io/docs/affiliate/trending-items)\n\nThe Trending Items API is designed to give the information on what is bestselling on Walmart.com right now.\n\n```py\ndata = walmart_io.trending()\n```\n\n## Logging\n\nWIOpy supports logging via the logging module. Configuration of the logging module can be as simple as:\n\n```py\nimport logging\n\nlogging.basicConfig(level=logging.INFO)\n```\n\n-------\n![License](https://img.shields.io/github/license/CoderJoshDK/WIOpy)\n![GitHub last commit](https://img.shields.io/github/last-commit/CoderJoshDK/WIOpy)\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2022 CoderJoshDK  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "A Python wrapper for the Walmart IO API",
    "version": "1.1.0",
    "project_urls": {
        "Bug Reports": "https://github.com/CoderJoshDK/WIOpy/issues",
        "Homepage": "https://github.com/CoderJoshDK/WIOpy",
        "Source": "https://github.com/CoderJoshDK/WIOpy"
    },
    "split_keywords": [
        "aiohttp",
        "api",
        "affiliate",
        "async",
        "walmart",
        "walmartio",
        "wrapper"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1fcf7cab262bd126b1c6a6675f3c8e322158fb4cdc469185ed2342e39645f50d",
                "md5": "5a22f65799f9c9cc05bcab3d7f67228c",
                "sha256": "c6841e0ae993427bddbe45ebadf0dc6d1c60d6078e76be723d164dec54956b03"
            },
            "downloads": -1,
            "filename": "wiopy-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5a22f65799f9c9cc05bcab3d7f67228c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 27056,
            "upload_time": "2024-01-08T02:31:42",
            "upload_time_iso_8601": "2024-01-08T02:31:42.860876Z",
            "url": "https://files.pythonhosted.org/packages/1f/cf/7cab262bd126b1c6a6675f3c8e322158fb4cdc469185ed2342e39645f50d/wiopy-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7a2ff6f0f68c4fdc6e3db8ff244dcd1c617ade0c95e4165f7a49c2f248be809f",
                "md5": "aa0d3ff0b1b19e30a97b96f58bc9ad52",
                "sha256": "0fcfe278197b4934cbf21ebed63877f53030a75ab5c61c733cd8aab1989cb84b"
            },
            "downloads": -1,
            "filename": "wiopy-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "aa0d3ff0b1b19e30a97b96f58bc9ad52",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 17632,
            "upload_time": "2024-01-08T02:31:44",
            "upload_time_iso_8601": "2024-01-08T02:31:44.405157Z",
            "url": "https://files.pythonhosted.org/packages/7a/2f/f6f0f68c4fdc6e3db8ff244dcd1c617ade0c95e4165f7a49c2f248be809f/wiopy-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-08 02:31:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "CoderJoshDK",
    "github_project": "WIOpy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "wiopy"
}
        
Elapsed time: 0.17141s