Skip to content

Conversation

@akolechkin
Copy link

Hello.

I would like to suggest some changes in rocket.

  1. rocket/http_handling.py
    When i worked with sailthru.com i found that rocket not working with send.delete.
    I've investigated that problem, and drop on a problem with urllib2. It doesn't support http DELETE method out of box. I created a successor of urllib2.Request class, with various http-methods support.
    Another issue, i found, you can see here https://github.com/exfm/rocket/blob/master/rocket/http_handling.py#L81
    RocketAPIError is not in namespace, and i couldn't find implementation of this class, as well i don't know behavior of this class.

  2. rocket/rocket.py
    It looks like an improvement, for easy support of lightweight callbacks to a method.
    f.e I would like to handle any error that could happen at remote api call.
    I can write a handler like that:

    def my_error_handler(event):
        """
        event - is rocket.Event class instance.
        """
    
        if event.succeed:
            # means no exception here
            write_in_db(event.response.somevalue)
        else:
            # means exception here
            logging.critical('Error at sending %s %s' % (event.method, event.ns_fun)
    
    api = Sailthru(...)
    api.add_callback('post', 'send', my_error_handler)        
    
    #otherwise, if i want to handle all the calls:
    
    api.add_callback(None, None, my_error_handler)        
    
    #or any post callback
    
    api.add_callback('post', None, my_error_handler)        
    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant