I have been trying to wrap my head around a few things and I havent found a concrete solution for the same.
I want to use a SOAP web service to get an XML data and then parse the received XML data.
So far, I have only found libraries compatible with python 2.xx and I want something comaptible with python 3.xx. I have tried Zeep but I wasnt able to configure it as its module was released on May 15th.
Anyway, I would like to be guided towards a library which can help me setup a SOAP client on python 3.6 allowing me to use its methods to send requests and consume the response.
My research has shown zeep is really the only currently maintained one. I'm using python 3.6 and using it for SOAP (5/2019).
Quick google search came up with these links which are fresh for 5/2019:
What SOAP libraries exist for Python 3.x? which I believe is already referenced in the comments (I'm new and can't comment).
Another link
https://www.slant.co/topics/268/~best-soap-client-libraries-for-python is good, though the "last updated" column is misleading. Zeep has been updated with in months, but the others have not been updated in years.
Related
I have found enough support for creating webservices using soap in java. But not able to find much support on creating soap web services in python.
Got soaplib https://pypi.python.org/pypi/soaplib? but support is less. Please suggest some useful libraries for SOAP in python
soaplib worked fine for me with django. All of the cool kids are using REST api's and slinging JSON back and forth. But I like XML. XML is like violence, if it doesn't solve your problem, you are not using enough.
stackoverflow.com/questions/15436749/how-to-call-soap-api-with-python
www.diveintopython.net/soap_web_services/
stackoverflow.com/questions/18175489/python-soap-using-requests
I used to get twitter data using R with an xml package. Seems like they no longer use xmls and only use json. I tried a few methodologies with json and I keep getting an error saying API 1.0 not available anymore and I need to use API 1.1. Fine but there seems to be no clear documentation in how to.
Can someone guide me to a location or provide sample code for getting twitter data.
I used to do this in R but seems like python is better for this. If someone can provide a guide in either or both would be very much appreciated.(or some sample code with explanation)
Thanks
I recommend using sixohsix's twitter library for Python.
There is some documentation on the github page, and if you're familiar with at least a bit of Python (I didn't know Python very well when I started using it), then it's pretty easy to use. It supports API v1.1 (v1.0 is deprecated and doesn't even work anymore, afaik).
With some Python scripts on a Ubuntu netbook I was able to continuously query the API for almost a year now, without one crash. I wouldn't recommend R for this, especially if you're after a lot of data.
You can still use R for data analysis, you can actually plug it into your Python scripts directly using rpy2.
This package might be useful. It was just released a few days ago.
twitteR package for R
The Twitter API was updated from version 1.0 to version 1.1. Many codes are now defunct since authentication is needed. Many blog posts with code samples are no longer valid.
For Python, I prefer the bear's package.
For R, I think the standard package is twitteR.
Whatever you do, you'll have to authenticate your "application" as a developer: link.
I have an wsdl file describing the communication server-client on a Java product.
I'm implementing a new server based on Python that will implement the same services.
Do you know of any method to create the Python server code based on the wsdl, that does not requires me to write all of the complextypes involved?
Also, what Api do you recommend?
This question has not received enough attention.
The currently accepted answer is good, but its answer is 'no'. Is there really no reasonably maintained and general solution?
Unfortunately, I don't think the negative answer is due to lack of attention to the question. There really is no support for WSDL in python. If you want to avoid the complexities of building your own soap envelope from scratch the only thing I can recommend you is building a sample envelope using any of the many soap webservices tools (soapui for instance) and then use it as a template string (I know, horrible) in your python code
UPDATE you could use spyne. It's a python RPC toolkit that among other protocols supports SOAP. It will create the WSDL for you, but if your objective is implementing the service described by the WSDL you already have then you'll have to fine tune your spyne service (written in python) until the generated WSDL matches the original
When it comes to SOAP support, Python unfortunately no longer is with "batteries included". The support on client side is acceptable but on server side you are basically on your own.
You might want to look at the following for starters:
http://wiki.python.org/moin/WebServices
http://pywebsvcs.sourceforge.net/
http://doughellmann.com/2009/09/01/evaluating-tools-for-developing-with-soap-in-python.html
If you really want to go on this route, it seems that ZSI is the tool to use, although I have my doubts that it will work with the latest 2.x Python distribution.
Using Python 2.6.6, I tried to use ZSI 2.0 to build a web service starting from the WSDL. Got some "module has been deprecated" warnings when generating the code with wsdl2py and wsdl2dispatch, had to separately install PyXML and hack my sys.path just to make it resolve first or else I got "module ext.reader does not exist" then only to end up with a disappointing "ZSI:EvaluateException Got None for nillable(False), minOccurs(1) element" error on a basic "Hello world!" WS with a required element.
Switched to ZSI 2.1_a1 which no longer needs PyXML and wsdl2py does it all (what wsdl2dispatch did for 2.0) but still ended up in a dead end with "ZSI:EvaluateException Got None for nillable(False), minOccurs(1) element" errors.
The experience wasn't very fun but it was enough for me to form an opinion about what Python has to offer for SOAP web services... which ain't much (and that was just for basic web services nothing fancy like WS-* specs). YMMV!
EDIT : I recently bumped into this SO question, and although oriented versus a client solution, it does also mention a few libraries for building SOAP services.
I have a requirement to build a client for Shopify's API, building it in Python & Django.
I've never done it before and so I'm wondering if someone might advise on a good starting point for the kinds of patterns and techniques needed to get a job like this done.
Here's a link to the Shopify API reference
Thanks.
Your question is somewhat open-ended, but if you're new to Python or API programming, then you should get a feel for how to do network programming in Python, using either the urllib2 or httplib modules that come with more recent versions of Python. Learn how to initiate a request for a page and read the response into a file.
Here is an overview of the httplib module in Python documentation:
http://docs.python.org/library/httplib.html
After you've managed to make page requests using the GET HTTP verb, learn about how to make POST requests and how to add headers, like Content-Type, to your request. When communicating with most APIs, you need to be able to send these.
The next step would be to get familiar with the XML standard and how XML documents are constructed. Then, play around with different XML libraries in Python. There are several, but I've always used xml.dom.minidom module. In order to talk to an API, you'll probably need to know to create XML documents (to include in your requests) and how to parse content out of them. (to make use of the API's responses) The minidom module allows a developer to do both of these. For your reference:
http://docs.python.org/library/xml.dom.minidom.html
Your final solution will likely put both of these together, where you create an XML document, submit it as content to the appropriate Shopify REST API URL, and then have your application deal with the XML response the API sends back to you.
If you're sending any sensitive data, be sure to use HTTPS over port 443, and NOT HTTP over port 80.
I have been working on a project for the last few months using Python and Django integrating with Shopify, built on Google App Engine.
Shopify has a valuable wiki resource, http://wiki.shopify.com/Using_the_shopify_python_api. This is what I used to get a good handle of the Shopify Python API that was mentioned, https://github.com/Shopify/shopify_python_api.
It will really depend on what you are building, but these are good resources to get you started. Also, understanding the Shopify API will help when using the Python API for Shopify.
Shopify has now released a Python API client: https://github.com/Shopify/shopify_python_api
I think you can find some inspiration by taking a look at this:
http://bitbucket.org/jespern/django-piston/wiki/Home
Although it is directly opposite what you want to do (Piston is for building APIs, and what you want is to use an API) it can give you some clues on common topics.
I could mention, of course, reading obvious sources like the Shopify developers forum:
http://forums.shopify.com/categories/9
But I guess you already had it in mind :)
Cheers,
H.
Has anybody created a nice wrapper around Yahoo's geo webservice "GeoPlanet" yet?
After a brief amount of Googling, I found nothing that looks like a wrapper for this API, but I'm not quite sure if a wrapper is what is necessary for GeoPlanet.
According to Yahoo's documentation for GeoPlanet, requests are made in the form of an HTTP GET messages which can very easily be made using Python's httplib module, and responses can take one of several forms including XML and JSON. Python can very easily parse these formats. In fact, Yahoo! itself even offers libraries for parsing both XML and JSON with Python.
I know it sounds like a lot of libraries, but all the hard work has already been done for the programmer. It would just take a little "gluing together" and you would have yourself a nice interface to Yahoo! GeoPlanet using the power of Python.