brent timothy saner via plug on 12 Apr 2022 10:44:13 -0700 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: [PLUG] Resources: Python REST client? |
On 4/12/22 13:37, JP Vossen via plug wrote: > We have some open tickets at $WORK involving writing some Python code to > interact with various REST APIs, notably Jira/Insight and > Elasticsearch/Kibana. Is anyone aware of a good "Building REST API > clients in Python" book or resource? There are tons of books on doing > the server side--that is, writing the server and API part in Python. > But I'm having trouble finding the opposite. > > Clues? Thanks. > JP The requests module is usually pretty good for it. https://www.nylas.com/blog/use-python-requests-module-rest-apis/ gives you a good overview, but surprisingly most third-party resources don't go into requests.Session[0] - which is perfect for API usage. If you subclass[1] to use a base URI, you can use relative URLs for your API endpoints directly (and can more easily manage a variabled domain name). [0] https://docs.python-requests.org/en/master/user/advanced/#session-objects [1] https://github.com/psf/requests/issues/2554#issuecomment-109341010 https://stackoverflow.com/questions/42601812/python-requests-url-base-in-session ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug