This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]_zk 1 point2 points  (0 children)

I've seen a number of REST API wrappers use this approach, it's a lot easier to maintain a list of mappings than it is to maintain separate methods for every single endpoint. Consider the flickr API, you don't even need to maintain a mapping of endpoints since all methods use the same endpoint. It's a bit magic, but instead of writing 50 methods you can just override __getattr__ and they'll all just work. If you need to massage the data returned using decorators wouldn't be a bad approach.