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?
I was able to fix this by using 'website("end-point")' instead of 'website.end-point'. I hope this helps someone else out.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.