Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add ERROR HANDLER to active Bottlenose connection #32

Closed
arcee123 opened this issue Aug 10, 2014 · 4 comments
Closed

How to add ERROR HANDLER to active Bottlenose connection #32

arcee123 opened this issue Aug 10, 2014 · 4 comments
Assignees
Labels

Comments

@arcee123
Copy link

arcee123 commented Aug 10, 2014

I am getting 503's.
According to your instructions, I need to add a error_handler as per instructions.
in the instructions I placed the function:

def error_handler(err):
    ex = err['exception']
    if isinstance(ex, HTTPError) and ex.code == 503:
        time.sleep(random.expovariate(0.1))
        return True

Your instruction says use this line:

amazon = bottlenose.Amazon(ErrorHandler=error_handler)

I have this:

amazon = bottlenose.Amazon(AWSAccessKeyId=ACCESS_KEY_ID, AWSSecretAccessKey = SECRET_KEY,AssociateTag = ASSOC_TAG)

I tried to add the option several ways, such as this:

amazon = bottlenose.Amazon(AWSAccessKeyId=ACCESS_KEY_ID, AWSSecretAccessKey = SECRET_KEY,AssociateTag = ASSOC_TAG,ErrorHandler=error_handler)

But I'm still getting 503's. I assume I am not setting it right.
I'm hoping you might be able to tell me where I am missing this.
Thank you

@stephnr
Copy link
Contributor

stephnr commented Aug 11, 2014

Please refer to this Gist as an example of how to retrieve data from the Amazon API using Bottlenose

https://gist.github.com/Stephn-R/8644621

If you have any questions, feel free to ask.

@arcee123
Copy link
Author

Hi, thank you.
I have the bottlenose/amazon api script in place.
it does work....but amazon's load balancing is causing requests to stop.
I am told that the Error_Handler script will handle Amazon's throttling mechanisms, but it appears I'm not doing it right. Can you help me? I need to know if I messed it up? or is there something I'm missing....

Thank you

@stephnr
Copy link
Contributor

stephnr commented Aug 12, 2014

How many requests are you making? Is the data your requesting considered to be "high volume"? Amazon does allow data requests but if you request too much at once, you will be prevented via a 503.

@dlo dlo added the question label Aug 12, 2014
@dlo dlo self-assigned this Feb 9, 2017
@dlo dlo closed this as completed Feb 9, 2017
@lionheart lionheart locked and limited conversation to collaborators Feb 9, 2017
@dlo
Copy link
Member

dlo commented Feb 9, 2017

I've created a "bottlenose" tag on Stack Overflow and encourage anyone running into usage-related questions there instead of here on the issue tracker. Please only open a new issue if you find a bug or have a feature request. Thanks! ✨

@lionheart lionheart unlocked this conversation Feb 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants