Media types with parameters (@cherrypy.tools.accept)
Aaron Dalton <[email protected]> Fri, 4 Aug 2017 07:33:27 -0700 (PDT)
| Newsgroups | gmane.comp.python.cherrypy |
|---|---|
| Message-ID | <[email protected]> |
I'm hoping to version my RESTful API using "application/vnd.*" media types.
Instead of embedding the versions in the media type itself, I'd prefer to
use the parameter format: "application/vnd.mycompany.myresource+json;
version=2". How do I access the parameter in the handler?
class MyClass(object):
exposed = True
@cherrypy.tools.accept(media="application/vnd.mycompany.myresource+json"
)
def GET(self):
#do something with the "version" parameter
Thanks for your help!
Aaron
--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cherrypy-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
To post to this group, send email to cherrypy-users-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.