Giter Site home page Giter Site logo

retwist's People

Contributors

cristianc-ty avatar sportsracer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

retwist's Issues

Improve Sentry error capturing

The Sentry error capturing system currently integrated in retwist will more or less only tell you that an error happened, but not how. Most importantly, it will not tell you the request URL or POST data, which would be crucial to effectively debug an error.

Given the Twisted request object, you can prepare the data like this to match Sentry's interface:

context = {"request": {
    'url': str(request.URLPath()),
    'method': request.method,
    'headers': list(request.requestHeaders.getAllRawHeaders()),
    'query_string': request.uri.replace(request.path, '').strip('?'),
    'data': {k: v[0] for k, v in request.args.items()}
}}

Given an instance client of raven.Client, this context object can then either be stored for future errors via client.context.merge(context) or be passed directly to the client.captureException method as attribute data.

(For TY employees, this is WIDGET-2298 in JIRA)

Non-ASCII characters in error message cause UnicodeDecodeError

Raising an error with non-ASCII characters in the error message raises a server-side exception:

# e.g. in json_GET
raise Error(400, u"Not a valid argument: äöü".encode("utf-8"))

Either make this work, or document (and enforce?) that only ASCII is allowed in error messages.

Sentry integration

Make it possible to report server errors to Sentry, optionally.

Do this from log_server_error, by subclassing it enabling it via flag or something. Inject the configuration there somehow.

Don't add Sentry as a dependency - retwist should install without it.

Add an example that demonstrates usage.

Mark as typed project as per PEP 561

retwist has type annotations which could help validate types in projects that use it.

However, in order to make that possible, we need to signal that we have valid type annotations, e.g. by placing a py.typed marker file.

please make some examples

Can show us more samples on how to handle incomplete variables from url inputs?
Does it handle POST method? Can show more sample code?

Support parameter names which are reserved keywords

Right now you can't do this:

class MyResource(retwist.ParamResource):
    from = retwist.Param()
    to = retwist.Param()

... because from and to are reserved keyword. Support setting those parameter names somehow!

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.