+ 1
FastAPI Resources
Hey all - I need to build a way to send various SOAP API calls through a proxy server. I know there are ways to do this in Node.js, Go, etc, but I'd prefer to do it in python as im most comfortable in that space. I know FastAPI, Flask & Django can do this, but I'm struggling to find so good resources to learn how to do this. I'm leaning towards FastAPI because I work at a small Credit Union and the traffic is going to be pretty light. Anyway any insight is helpful.
2 Answers
+ 2
You are saying that you want to "send API calls", to me this means that you want to CONSUME a web service. FastAPI, Django and Flask are actually frameworks to build web services that PROVIDE these API's.
To call web services you can use the built-in requests library
https://stackoverflow.com/questions/18175489/sending-soap-request-using-JUMP_LINK__&&__python__&&__JUMP_LINK-requests
However the SOAP API requires XML data, and creating that XML or processing the response is a bit more complicated, that just parsing a REST response in javascript.
But luckily there are also Python libraries to handle this for you, zeep is the most popular.
https://docs.python-zeep.org/
Example of zeep:
https://sololearn.com/compiler-playground/c01G2aeaG7d0/?ref=app
Also, instead of requests you can use httpx library, to create asynchronous calls and use a shared connection pool.
https://www.python-httpx.org/
I can recommend this recent video from ArjanCodes youtube channel, about requests and httpx
https://youtu.be/OPyoXx0yA0I?si=9bazI_IP7c5M-IvJ
0
David Bremner ,
From what I've seen, Sololearn doesn't teach much about any Python libraries that you have to import to use.
But I would bet most libraries have docs on GitHub if not their own stand-alone websites with tutorials and discussion forums. Have you searched?