Skip to content

HTTP Error 410: Gone. Using outdated API? #165

Open
@floriandotpy

Description

Thanks for this module! I have been trying my first steps today, by my requests produce an error:

HTTPError: HTTP Error 410: Gone

When I login to PartnerNet, I currently see a huge red notification telling everyone that the API v4 has been discontinued since 31 March, 2020 (which was 5 weeks ago as I am typing this).

Is it possible the module still uses API v5, which would explain the error?

I'll try using the new API without the wrapper for now. But would be happy about any response, if this is indeed the issue.

Detailed example below.


from amazon.api import AmazonAPI

# fill these in if you want to try the example
secrets = {
  "access_key": "",
  "secret_key": "",
  "assoc_id": ""
}

amazon = AmazonAPI(secrets['access_key'], secrets['secret_key'], secrets['assoc_id'], region='US')

products = amazon.search(Keywords='Tolkien', SearchIndex='All')

for i, product in enumerate(products):
    print(f"{i}: f{product.title}")

Output:

---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
<ipython-input-9-cc24b8799447> in <module>
----> 1 for i, product in enumerate(products):
      2     print(f"{i}: f{product.title}")

~/projects/tolkien-stats/venv/lib/python3.6/site-packages/amazon/api.py in __iter__(self)
    542             Yields a :class:`~.AmazonProduct` for each result item.
    543         """
--> 544         for page in self.iterate_pages():
    545             for item in getattr(page.Items, 'Item', []):
    546                 yield AmazonProduct(

~/projects/tolkien-stats/venv/lib/python3.6/site-packages/amazon/api.py in iterate_pages(self)
    559             while not self.is_last_page:
    560                 self.current_page += 1
--> 561                 yield self._query(ItemPage=self.current_page, **self.kwargs)
    562         except NoMorePages:
    563             pass

~/projects/tolkien-stats/venv/lib/python3.6/site-packages/amazon/api.py in _query(self, ResponseGroup, **kwargs)
    571             An lxml root element.
    572         """
--> 573         response = self.api.ItemSearch(ResponseGroup=ResponseGroup, **kwargs)
    574         root = objectify.fromstring(response)
    575         if (hasattr(root.Items.Request, 'Errors') and

~/projects/tolkien-stats/venv/lib/python3.6/site-packages/bottlenose/api.py in __call__(self, **kwargs)
    272         # make the actual API call
    273         response = self._call_api(api_url,
--> 274                                   {'api_url': api_url, 'cache_url': cache_url})
    275 
    276         # decompress the response if need be

~/projects/tolkien-stats/venv/lib/python3.6/site-packages/bottlenose/api.py in _call_api(self, api_url, err_env)
    233                 else:
    234                     # the simple way
--> 235                     return urllib2.urlopen(api_request, timeout=self.Timeout)
    236             except:
    237                 if not self.ErrorHandler:

/usr/lib/python3.6/urllib/request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)
    221     else:
    222         opener = _opener
--> 223     return opener.open(url, data, timeout)
    224 
    225 def install_opener(opener):

/usr/lib/python3.6/urllib/request.py in open(self, fullurl, data, timeout)
    530         for processor in self.process_response.get(protocol, []):
    531             meth = getattr(processor, meth_name)
--> 532             response = meth(req, response)
    533 
    534         return response

/usr/lib/python3.6/urllib/request.py in http_response(self, request, response)
    640         if not (200 <= code < 300):
    641             response = self.parent.error(
--> 642                 'http', request, response, code, msg, hdrs)
    643 
    644         return response

/usr/lib/python3.6/urllib/request.py in error(self, proto, *args)
    568         if http_err:
    569             args = (dict, 'default', 'http_error_default') + orig_args
--> 570             return self._call_chain(*args)
    571 
    572 # XXX probably also want an abstract factory that knows when it makes

/usr/lib/python3.6/urllib/request.py in _call_chain(self, chain, kind, meth_name, *args)
    502         for handler in handlers:
    503             func = getattr(handler, meth_name)
--> 504             result = func(*args)
    505             if result is not None:
    506                 return result

/usr/lib/python3.6/urllib/request.py in http_error_default(self, req, fp, code, msg, hdrs)
    648 class HTTPDefaultErrorHandler(BaseHandler):
    649     def http_error_default(self, req, fp, code, msg, hdrs):
--> 650         raise HTTPError(req.full_url, code, msg, hdrs, fp)
    651 
    652 class HTTPRedirectHandler(BaseHandler):

HTTPError: HTTP Error 410: Gone

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions