Home > database >  How to send request to a public web service with Python?
How to send request to a public web service with Python?

Time:11-25

i need a guide to establish a connection to a public web service, send request to it and get response back. for example this web service:

http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL

i've tried to test this API with SoapUI application. this API has a bunch of methods such as sending you a country's capital by getting it's ISO name (send IR as request and get Tehran as respond). now somehow i want to do this through Python. i want to have access to all it's methods and send requests. only by connecting to API's address or any other way (maybe by loading each method's XML code and running it in Python? idk). is it possible? any guide?

CodePudding user response:

I'd recommend checking out this library:

https://requests.readthedocs.io/en/latest/

You can send HTTP requests to URL endpoints, parse out data, etc. Hope this helps!

CodePudding user response:

I have successfully used suds and SOAPpy in the past. I see people recommend Zeep nowadays but I haven't used it.

  • Related