Nice Python wrapper for Yahoo's Geoplanet web service? - python

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.

Related

Using a SOAP WSDL with python

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.

send http request using django and get results

This might seem like an extremely simple and stupid question yet i can't find a convenient answer.
I'm trying to use google's reverse geocodding api with django, as the website explains (at https://developers.google.com/maps/documentation/geocoding/start?csw=1#ReverseGeocoding) I'm supposed to send a request to the url :
https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&key=<_api_key>
But I can't find an appropriate way to send this request using django to google api.
To me it seems something so simple will be doable by some method built-in django but all I could find was modules to install.
If there's no way but installing other python modules which one's the best?
Well, the most straightforward way would be to install requests library and simply call:
result = requests.get(your_link)
You can find additional information (e.g., how to authenticate, use cookies, etc., as well as how to access data in response) in the library's docs. The requests library is very well written, very intuitive and simple to use. Quite a lot of smart people and companies use it, too, so it's not a half-baked library someone just hacked out over the weekend (as of this moment, it has 6060 commits and 595 contributors on GitHub).
If you absolutely must avoid external libraries, why not try urllib.request. It's a bit more complicated, and even the docs themselves recommend using requests if you prefer higher-level interface. But you definitely can get the job done with it. To get started, you can read the docs on how to use it to fetch data. Read this thread for an example of how to extract json from a response you'd get with urllib.

get twitter feed (R or python)

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.

NOAA hourly data with python

Are there any python programs which will grab detailed data from NOAA, particularly the hourly data and the 7-day day/night forecasts?
I found python-weather-api, python-weather, and python-noaa. However they are either no longer supported or lack the data that I'd like.
If not, then I'll probably make one myself although I'd prefer not to reinvent the wheel!
It looks like the National Digital Forecast Database (NDFD) Simple Object Access Protocol (SOAP) Web Service is what you're looking for. You can use SOAP to access NDFD XML objects and parse them with Python quite easily - no 3rd-party libraries needed. If you prefer RESTful services you can do that too.
They even have a great graphic on how SOAP requests work.

Python (Django) Shopify API Client -- For a Beginner

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.

Categories

Resources