Reputation: 271
I'm using a REST wrapper in Python called Hammock. Better than I can explain "Hammock is a fun module lets you deal with rest APIs by converting them into dead simple programmatic APIs. It uses popular requests module in backyard to provide full-fledged rest experience."
It will turn api.website/end/point/ into website.end.point which makes working with the API pretty simple. The issue I've run into is when an endpoint has a character in it that Python does not allow in names, '-' in this case (ex api.website/end-point/). Accessing an endpoint like this turns into website.end-point, which is invalid python code.
I looked and '-' is a totally valid character to have in a REST endpoint name. Is there a way to allow this character, maybe the equivalent of a character escape or something? I think I could fix it in the inner code of the module, but figure that's probably a bad way to go about this. Any ideas?
Upvotes: 0
Views: 155
Reputation: 271
I was able to fix this by using 'website("end-point")' instead of 'website.end-point'. I hope this helps someone else out.
https://github.com/kadirpekel/hammock/issues/20
Upvotes: 0