Giter Club home page Giter Club logo

python-amazon-simple-product-api's People

Contributors

adamlwgriffiths avatar astrada avatar crobertsbmw avatar dbasedow avatar ericpauley avatar fabiant7t avatar fadedblue avatar frutik avatar gmbelart avatar hqtoan94 avatar iceraj avatar jbkkd avatar jparise avatar lechatpito avatar mbarekfiras avatar norman-thomas avatar orangain avatar patricksocha avatar philfreo avatar qoolloop avatar raccoonyy avatar reubano avatar rouge8 avatar sblondon avatar tacy avatar yoavaviram avatar ypcrumble avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-amazon-simple-product-api's Issues

Unable lookup multiple items

>>>products = amazon.lookup(ItemId='B0051QVESA,B005DOK8NW,B005890G8Y,B0051VVOB2,B005890G8O')

>>> len(products)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: object of type 'AmazonProduct' has no len()

eBook price always (None, None)

On eBooks all I get for product.price_and_currency is (None, None).

Trying with books everything runs fine.

Is it an API issue or an Amazon issue?

Wrong offer_url

Offer_url of AmazonProduct ignores the region givent at the construction of AmazonAPI when using "search_n" method.
So the offer_url is always "amazon.com"...

Test case TestAmazonCart.test_cart_modify fails

Hi,

When I run tests, the test case TestAmazonCart.test_cart_modify always fails. Although this does not affect my product code, this gets in the way of supporting Python 3, ref. #77. In my environment, the test case fails both in Python 2 and 3. @yoavaviram, could you tell me does it succeed in your environment?

Expected Result

All the tests succeed.

Actual Result

Only one test case TestAmazonCart.test_cart_modify always fails. Other tests succeed.

(venv2)$ nosetests
...................................E
======================================================================
ERROR: test_cart_modify (tests.TestAmazonCart)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/orange/github-libs/python-amazon-simple-product-api/tests.py", line 459, in test_cart_modify
    assert_equals(new_cart[cart_item_id].quantity, '3')
  File "/Users/orange/github-libs/python-amazon-simple-product-api/amazon/api.py", line 1312, in __getitem__
    raise KeyError('no item found with CartItemId: {0}'.format(cart_item_id,))
KeyError: 'no item found with CartItemId: C8AIO6HTRFXA6'
-------------------- >> begin captured logging << --------------------
bottlenose.api: DEBUG: Amazon URL: http://webservices.amazon.com/onca/xml?...
--------------------- >> end captured logging << ---------------------

----------------------------------------------------------------------
Ran 36 tests in 36.346s

FAILED (errors=1)

Environment

(venv2)$ python -V
Python 2.7.11
(venv2)$ pip freeze
bottlenose==0.6.3
docutils==0.12
funcsigs==1.0.2
Jinja2==2.8
lxml==3.6.0
MarkupSafe==0.23
mock==2.0.0
nose==1.3.7
pbr==1.10.0
Pygments==2.1.3
python-dateutil==2.5.3
six==1.10.0
Sphinx==1.1.3
wheel==0.24.0
You are using pip version 7.1.2, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Add support for similarity lookup

So far the API looks great. I was hoping to use the Similarity Lookup as well with the API. Any chance you can implement it?

Documentation is here:
http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/SimilarityLookup.html

I would write an implementation and push it but I am in the process of learning python and I fear it would take me several hours to implement, and would probably take you 15 minutes to implement. If you don't have time I can look into implementing it and making a pull request over the next few weeks.

Thanks!

AmazonProduct detail_page_url property removed

Hi,
The detail_page_url of AmazonProduct class has been removed. Any reason for this change please?
Also, on pypi the version of the package is python-amazon-simple-product-api==1.5.0 for the "version" which had detail_page_url and the one I just downloaded (using pip install -r requirements.txt) in which detail_page_url have been removed.
Thanks and regards.

Add python 3 support

hello, could you please port the code to support py3, you have no contributing doc, I can help if you need?

Batch Requests

Is there a way to do a search for multiple items in a single request (batch requests)?. This is very important because of amazon's one second rule. It does look like some one has implemented it elsewhere as I found this forum post.

JPY price

Why do you divide by 100 the Japanese price? I'm getting 11,00 JPY instead of 1100 JPY, that is the correct price.

Is quantity a call?

I don't believe to see quantity as a call to be made once a product is generated? Or am I missing something?

Prime

So far I got everything up and running to the way I like it. The only thing I have left to figure out is how to check if the item I am looking at has prime or not. Can this be done? I am hoping so, since you can pull price etc already. Basically just need it to say Yes/ No for prime; Yes if it finds the prime text/icon and No if it is missing from the listing.

I would appreciate any help on this, thanks again for this!

Python 3 support?

I realized this uses bottlenose which doesnt support Python 3. Has this package been written to work with Python 3? Or does that still have to be implemented? Thanks for this btw.

How to get Product Availability Info

Hi,

Is there a way to find availability of the product. Product availability in the response xml is under 'Offers.Offer.OfferListing.AvailabilityAttributes.AvailabilityType' element.

Thanks

retry when HTTP Error 503: Service Unavailable

I'm new to amazon api, I wrote a simple code. I run into 503 Error very often. just a retry will be ok.
should this module retry when service Unavailable?

LM-SHC-00950567:~ zhifan$ python a.py
0. '亚马逊Kindle电子书阅读器'

  1. '亚马逊Kindle Voyage电子书阅读器珍藏限量版'
  2. '亚马逊Kindle Paperwhite 电子书阅读器'
  3. 'How to Speak and Write Correctly (免费公版书)'
  4. '柏图 适配新款2014全新New Kindle保护套 499元版新Kindle电子书皮套 新Kindle休眠皮套 可携带电容笔 全机框包裹 抗摔防震 新Kindle及Kindle Paperwhite最佳选择 内含高清贴膜套装 特制商务款黑色'
  5. '知乎周刊·读书这件小事'
  6. '柏图 适配Kindle Paperwhite保护套(适用于1代和2代) KPW保护皮套 电子书套 磁扣疯马纹保护壳 酷炫黑 复古质朴可休眠 内含高清贴膜套装 磁扣疯马纹-炫酷黑'
  7. 'Kindle TOP 100 人气小说'
  8. '柏图 适配新款2014全新New Kindle保护套 499元版新Kindle电子书皮套 新Kindle休眠皮套 玛雅系列 抗摔防震 内含高清贴膜套装 玛雅系列-玛雅黑'
  9. '李鸿章传 (名人名传系列)'
  10. '亚马逊Kindle设备电源适配器(5W)'
  11. '红楼梦 (古典名著普及文库)'
  12. '柏图 适配新款2014全新New Kindle保护套 499元版新Kindle电子书皮套 新Kindle休眠皮套 玛雅系列 抗摔防震 内含高清贴膜套装 玛雅系列-墨水蓝'
  13. '唐诗三百首·宋词三百首·元曲三百首'
  14. '柏图 适配Kindle Paperwhite专款保护套(适用于1代和2代) KPW保护皮套 电子书套 Kindle经典商务款保护壳商务黑色 可携带电容笔 内含高清贴膜套装 K5-01 新版精选商务款商务黑色'
  15. '知乎周刊·无力拖延'
  16. '亚马逊Kindle Paperwhite真皮保护套 (适用于1代和2代)'
  17. '知乎周刊·新技能get'
  18. '柏图 适配Kindle Paperwhite保护套(适用于1代和2代) KPW保护皮套 电子书套 纤薄十字纹保护壳 墨水蓝 极致纤维可休眠 内含高清贴膜套装 墨水蓝'
  19. '呼兰河传 (典藏•萧红)'
    Traceback (most recent call last):
    File "a.py", line 11, in
    for i, product in enumerate(products):
    File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/amazon/api.py", line 234, in iter
    for page in self.iterate_pages():
    File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/amazon/api.py", line 250, in iterate_pages
    yield self._query(ItemPage=self.current_page, *_self.kwargs)
    File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/amazon/api.py", line 263, in _query
    response = self.api.ItemSearch(ResponseGroup=ResponseGroup, *_kwargs)
    File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/bottlenose/api.py", line 242, in call
    {'api_url': api_url, 'cache_url': cache_url})
    File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/bottlenose/api.py", line 203, in _call_api
    return urllib2.urlopen(api_request, timeout=self.Timeout)
    File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 153, in urlopen
    return opener.open(url, data, timeout)
    File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 461, in open
    response = meth(req, response)
    File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 571, in http_response
    'http', request, response, code, msg, hdrs)
    File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 499, in error
    return self._call_chain(_args)
    File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 433, in _call_chain
    result = func(_args)
    File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py", line 579, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
    urllib.error.HTTPError: HTTP Error 503: Service Unavailable

Possibility to pass the string directly

Hi, in my app i handle the request with bottlenose already (modified version of bottlenose) ...

is it possible to pass the string result to you api ? so i will have in return the object ?

Thanks

Can't seem to retrieve related items

I'm using this to search for MP3s. In this the XML contains a RelatedItems sections, this is where the album title is stored. I see it when I to_string() to product, but I can't figure out how to access it.

Have not managed to make the API work

Dear Yoav,

I followed all instructions to install the API on a Mac running OSX 10.11.4

All components (boottlenose, lxml, dateutil and the API itself were properly installed.

Yet, when attempting to follow one example I get the following response:

presentacion sin titulo 2

I am certain the access, secret and associate keys are correct.

My reading of the error messages is that the arguments are not flowing correctly across the code. But have not been able to figure out a solution.

New PyPi release

Could you please update the version on PyPi with the new kwargs from #38 and any other fixes since then?
Cheers

other attributes

other than title and price which other attributes can i get? for example - description, link to the actual product ( not its image ), shipping charges etc

make pagination :(

hi
i cant make a pagination, amazon returns 10 pages and this is not a good solution when it's blocking code :(
hope this features will be enabled.

HTTP Error 400 when viewing CA region

When I try looking up a product on US it works. But when I try to set the region to CA It returns even if the ItemID does exist on amazon.ca:

urllib.error.HTTPError: HTTP Error 400: Bad Request

If I test on other regions, it also still works. (assuming the id is valid) So it appears to only not work on canada.

error fetching python-lxml

hi, the md5 for python lxml is wrong when fetching it, using open suse here, i must install it alone.

break iteration on pages

Hi, thanks for the nice API!

I ran into a simple paging issue.

The following code

p = a.search(SearchIndex='Books', Author='john grisham', Power='pubdate:after 2014 and pubdate:before 2016')
for pp in p:
  print pp.release_date, '========', pp.title

seems to fail to understand paging, ultimately I get a 503. Here's more info though. I added some code in bottlenose/api.py, more specifically in _call_api() to print the first api_url param, and here's what I get (I stripped the noise in the URLs after the first one to highlight the problem):

http://ecs.amazonaws.com/onca/xml?AWSAccessKeyId=...&AssociateTag=...&Author=john%20grisham&ItemPage=1&Operation=ItemSearch&Power=pubdate%3Aafter%202014%20and%20pubdate%3Abefore%202016&ResponseGroup=Large&SearchIndex=Books&Service=AWSECommerceService&Timestamp=...&Version=2011-08-01&region=US&Signature=...
2015-05-12 ======== Theodore Boone: The Fugitive
2015-05-19 ======== Theodore Boone Box Set
2015-02-21 ======== The man from the fog
http://ecs.amazonaws.com/onca/xml?...ItemPage=2&...
http://ecs.amazonaws.com/onca/xml?...ItemPage=3&...
http://ecs.amazonaws.com/onca/xml?...ItemPage=4&...
http://ecs.amazonaws.com/onca/xml?...ItemPage=5&...
http://ecs.amazonaws.com/onca/xml?...ItemPage=6&...
http://ecs.amazonaws.com/onca/xml?...ItemPage=7&...
http://ecs.amazonaws.com/onca/xml?...ItemPage=8&...
http://ecs.amazonaws.com/onca/xml?...ItemPage=9&...
http://ecs.amazonaws.com/onca/xml?...ItemPage=10&...
http://ecs.amazonaws.com/onca/xml?...ItemPage=11&...
Traceback (most recent call last):
File "amzn.py", line 4, in
for pp in p:
File "/usr/lib/python2.6/site-packages/amazon/api.py", line 234, in iter
for page in self.iterate_pages():
File "/usr/lib/python2.6/site-packages/amazon/api.py", line 250, in iterate_pages
yield self._query(ItemPage=self.current_page, *_self.kwargs)
File "/usr/lib/python2.6/site-packages/amazon/api.py", line 263, in _query
response = self.api.ItemSearch(ResponseGroup=ResponseGroup, *_kwargs)
File "/usr/lib/python2.6/site-packages/bottlenose/api.py", line 243, in call
{'api_url': api_url, 'cache_url': cache_url})
File "/usr/lib/python2.6/site-packages/bottlenose/api.py", line 204, in _call_api
return urllib2.urlopen(api_request, timeout=self.Timeout)
File "/usr/lib64/python2.6/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib64/python2.6/urllib2.py", line 397, in open
response = meth(req, response)
File "/usr/lib64/python2.6/urllib2.py", line 510, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib64/python2.6/urllib2.py", line 435, in error
return self._call_chain(_args)
File "/usr/lib64/python2.6/urllib2.py", line 369, in _call_chain
result = func(_args)
File "/usr/lib64/python2.6/urllib2.py", line 518, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 503: Service Unavailable

So somehow amazon/api.py keeps iterating forever (it even goes beyond the hard page limit 10) even though the first ItemPage returned only 3 results (as I can tell by copy/pasting the first URL in my browser) and that should be the end.

I see there's search_n() but ultimately all I want is to return all the results of my search query, not the top N.

Can't get SalesRank

Even with the SalesRank response group I can't get the SalesRank attribute.

Handle amazon search returns no matches

When the API can`t find anything from search it terminates the program. Is there a way to handle the callback and just go to the next search in the list?

Is this for python 2 or 3?

I'm getting this error: HTTPError: HTTP Error 400: Bad Request

while using
product = amazon.lookup(ItemId='B00IUICOF8')

ps: I'm using python 2.7

Handle multiple ResponseGroups

The way this project currently works is by assuming there's only one response group ("Large"). The Product class is based on that response group, plus a few extras which are relevant to different ResponseGroups.

We should majorly refactor this to address different ResponseGroups and allow easy access to their fields (or Resposne Elements, as named by Amazon).

Reference for ResponseGroup can be found here, with the valid values:
http://docs.aws.amazon.com/AWSECommerceService/latest/DG/ItemLookup.html

I'll be adding a few fields to the Product class meanwhile, but will try to iterate on creating a class that'll handle multiple response groups, or a class for each response group.

Boolean advanced search operators dont seem to work

For some reason when trying to use power searching (http://docs.aws.amazon.com/AWSECommerceService/latest/DG/PowerSearchOperators.html)

This script returns no results. It seems that the "or" logic is not working as I would expect it to. Has anyone else experienced this?

from amazon.api import AmazonAPI
amazon = AmazonAPI('secret', 'secret', 'secrettag)
products = amazon.search_n(6,Keywords='bottle OR gear OR tree or coffee or house or melon',SearchIndex='Apparel',Sort='relevancerank')

could not get products more than 50 numbers using search() method ?

Hi guys,
I know its a silly question. But its taking a quite a lot of time to figure it out. When i use the below script, i could able to get only 50 products and not more than that. but when i checked for products.current_page, i can see the value is '6'. I'm not sure how to iterate other products after that. Please help me with a good example to get the list of all the products available using search method. If not suggest me any other way of doing it.. Thanks in Advance.

from amazon.api import AmazonAPI
amazon = AmazonAPI(AMAZON_ACCESS_KEY, AMAZON_SECRET_KEY, AMAZON_ASSOC_TAG)
products = amazon.search(Keywords='kindle', SearchIndex='All')
for i, product in enumerate(products):
print "{0}. '{1}'".format(i, product.title)

Batch Lookups

I'm running the example code for batch item lookups

from amazon.api import AmazonAPI
amazon = AmazonAPI('XXX', 'XXX', 'XXX')
products = amazon.lookup(ItemId="B0051QVESA,B005DOK8NW,B005890G8Y,B0051VVOB2,B005890G8O") 
len(products) 

and i'm getting the following error

TypeError: object of type 'AmazonProduct' has no len()

Am I doing something wrong ?

Problems Using with lxml 3.2.3

I've installed bottlenose and lxml using pip. Pip installed lxml 3.2.3, which I thought would be fine (I didn't see a version specified). Turns out this is not the case. When I attempt to import AmazonAPI I get the error "No module named lxml".

Retrieve Attributes of get_attributes

Right now I can only seem to access the text of elements with get_attributes. Is there a way to access the attributes of these elements? Specifically I'm trying to access the Units attribute of ItemDimensions.Weight

Fails to parse some publication dates.

The following product fails to have it's publication date parsed correctly. ASIN 0933635869.
The date is in the 'Item' data is the format "PublicationDate": "1992-05",
The resulting value in product.publication_date is None.

The dateutil library is able to parse dates like this, its probably worth using it instead.

>>> import dateutil.parser
>>> dateutil.parser.parse('1992-05')
datetime.datetime(1992, 5, 15, 0, 0)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.