Skip to content

Commit 130f10e

Browse files
committed
improve variable names on readme
1 parent 306cf1c commit 130f10e

File tree

1 file changed

+26
-21
lines changed

1 file changed

+26
-21
lines changed

README.md

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,20 @@ $ pip install WIOpy --upgrade
2323
An example of creating a WIOpy connection
2424
One important note is that you need to pass in the private key file *path*.
2525
```py
26-
from WIOpy import WalmartIO
27-
28-
wiopy = WalmartIO(private_key_version='1', private_key_filename='./WM_IO_private_key.pem', consumer_id='XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX')
29-
data = wiopy.product_lookup('33093101')[0]
26+
from wiopy import WalmartIO
27+
walmart_io = WalmartIO(
28+
private_key_version="1",
29+
private_key_filename="./WM_IO_private_key.pem",
30+
consumer_id='XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
31+
publisherId="XXXXXXX",
32+
)
33+
data = walmart_io.product_lookup('33093101')[0]
3034
```
3135
WIOpy also supports asynchronous calls. To use, everything will be the same but you must await a call and the constructed object is different.
3236
```py
33-
from WIOpy import AsyncWalmartIO
34-
wiopy = AsyncWalmartIO(...)
35-
data = await wiopy.product_lookup('33093101')[0]
37+
from wiopy import AsyncWalmartIO
38+
async_walmart_io = AsyncWalmartIO(...)
39+
data = await async_walmart_io.product_lookup('33093101')[0]
3640
```
3741

3842
## Response Examples
@@ -54,15 +58,15 @@ While there may be a response missing or a response not being converted to an ob
5458
### [Catalog Product](https://walmart.io/docs/affiliate/paginated-items)
5559
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.
5660
```py
57-
data = wiopy.catalog_product(category='3944', maxId='8342714')
61+
data = walmart_io.catalog_product(category='3944', maxId='8342714')
5862
```
5963
A catalog response contains category, format, nextPage, totalPages, and a list of items
6064

6165

6266
### [Post Browsed Products](https://walmart.io/docs/affiliate/post-browsed-products)
6367
The post browsed products API allows you to recommend products to someone based on their product viewing history.
6468
```py
65-
data = wiopy.post_browsed_products('54518466')
69+
data = walmart_io.post_browsed_products('54518466')
6670
```
6771
Response gives top 10 relevant items to the given id
6872

@@ -71,12 +75,12 @@ Response gives top 10 relevant items to the given id
7175
There are two ways to lookup a product
7276
The first is to pass a single string in
7377
```py
74-
data = wiopy.product_lookup('33093101')[0]
78+
data = walmart_io.product_lookup('33093101')[0]
7579
```
7680
or you can pass a list of strings
7781
```py
78-
data = wiopy.product_lookup('33093101, 54518466, 516833054')
79-
data = wiopy.product_lookup(['33093101', '54518466', '516833054'])
82+
data = walmart_io.product_lookup('33093101, 54518466, 516833054')
83+
data = walmart_io.product_lookup(['33093101', '54518466', '516833054'])
8084
```
8185
Remember: product_lookup always returns a list of [WalmartProducts](https://walmart.io/docs/affiliate/item_response_groups)
8286

@@ -85,31 +89,32 @@ Remember: product_lookup always returns a list of [WalmartProducts](https://walm
8589
`bulk_product_lookup` is similar to `product_lookup` however, the bulk version does not raise errors and it is a generator.
8690
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.
8791
```py
88-
data = wiopy.bulk_product_lookup('33093101, 54518466, 516833054', amount=1, retries=3)
92+
data = walmart_io.bulk_product_lookup('33093101, 54518466, 516833054', amount=1, retries=3)
8993
for items in data:
9094
for item in items:
9195
print(item)
9296
```
9397
Response gives generator of [WalmartProducts](https://walmart.io/docs/affiliate/item_response_groups)
9498
If you are unfamiliar with async generators; to properly call the async version:
9599
```py
96-
data = wiopy.bulk_product_lookup('33093101, 54518466, 516833054')
100+
data = async_walmart_io.bulk_product_lookup('33093101, 54518466, 516833054')
97101
async for items in data:
102+
...
98103
```
99104

100105

101106
### [Product Recommendation](https://walmart.io/docs/affiliate/product-recommendation)
102107
Get recommendations based on a given product id
103108
```py
104-
data = wiopy.product_recommendation('54518466')
109+
data = walmart_io.product_recommendation('54518466')
105110
```
106111
Response gives a list of related products
107112

108113

109114
### [Reviews](https://walmart.io/docs/affiliate/reviews)
110115
The Reviews API gives you access to the extensive item reviews on Walmart that have been written by the users of Walmart.com
111116
```py
112-
data = wiopy.reviews('33093101')
117+
data = walmart_io.reviews('33093101')
113118
```
114119
Response gives review data
115120

@@ -118,34 +123,34 @@ Response gives review data
118123
Search API allows text search on the Walmart.com catalogue and returns matching items available for sale online.
119124
```py
120125
# Search for tv within electronics and sort by increasing price:
121-
data = wiopy.search('tv', categoryId='3944', sort='price', order='ascending')
126+
data = walmart_io.search('tv', categoryId='3944', sort='price', order='ascending')
122127
```
123128
You can also add facets to your search
124129
```py
125-
data = wiopy.search('tv', filter='brand:Samsung')
130+
data = walmart_io.search('tv', filter='brand:Samsung')
126131
```
127132
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
128133

129134

130135
### [Stores](https://walmart.io/docs/affiliate/stores)
131136
The API can return a list of closest stores near a specified location. Either zip code or lon/lat
132137
```py
133-
data = wiopy.stores(lat=29.735577, lon=-95.511747)
138+
data = walmart_io.stores(lat=29.735577, lon=-95.511747)
134139
```
135140

136141

137142
### [Taxonomy](https://walmart.io/docs/affiliate/taxonomy)
138143
The taxonomy service exposes the taxonomy used to categorize items on Walmart.com.
139144
Details about params is missing from docs
140145
```py
141-
data = wiopy.taxonomy()
146+
data = walmart_io.taxonomy()
142147
```
143148

144149

145150
### [Trending Items](https://walmart.io/docs/affiliate/trending-items)
146151
The Trending Items API is designed to give the information on what is bestselling on Walmart.com right now.
147152
```py
148-
data = wiopy.trending()
153+
data = walmart_io.trending()
149154
```
150155

151156
## Logging

0 commit comments

Comments
 (0)