
On 11/3/15 10:15 PM, Wang Yan wrote:
I'm planning to design some REST APIs with Twisted in Python. For example, I want to use the HTTP method "GET" to fetch a single user's information:
|GET http://myhost:8000/api/v1.0/users/[user_id] | I know I should inherit the twisted.web.resource.Resource and implement "getChild" by myself. The question is, should I implement a class for each segment of the URI? If so, I have to implement class API, class V1, class Users and Class User. In other words, if there're 10 segments in the URI, do I have to implement 10 classes to represent those resources?
Twisted is too low-level for such use in my opinion. We use Klein (https://github.com/twisted/klein) which offers nice abstraction above Twisted. I know this does not answer your question. Just wanted to make sure that you are aware of possible options. -Shakkhar [...]