Consuming Zanox web service in a Django project - python

I want to integrate Zanox feeds in a Django project. Unfortunately there seem to be no client library implementations in Python.
Or are there?
What is the next best alternative to a Python library? Using the Ruby version?

Would have been useful to say what Zanox was in your question. For those interested, they appear to be an advertising network.
Anyway, they do seem to expose a pretty simple XML or JSON feed, as documented here. It looks pretty simple to get that using urllib2 or requests and parse it using json.load.

You can use https://pypi.python.org/pypi/python-zanox-api/ in a custom management command.

Related

Posting data to another Site with Django

I would appreciate some help here.
Google checkout has many ways to send it checkout data. I am using the XML server-to-server.
I have everything ready and now I want to throw some xml at google. I have been doing some reading and I know of a couple of ways to do this, one with urllib, another with pyCurl, but I am using django over here and I searched the Django api for some way to POST data to another site and I havent fallen upon anything. I really would like to use the django way, if there is one because I feel it would be more fluid and right, but if you all don't know of any way I will probably use urllib.
urllib2 is the appropriate way to post data if you're looking for python standard library. Django doesn't provide a specific method to do this (as well as it shouldn't). Django goes out of it's way to not simply reinvent tools that already exist in the the standard library (except email...), so you should never really fear using something out of the python standard library.
requests is also great, but not standard library. Nothing wrong with that though.

iTunes API for python scripting

I'm trying to develop some scripts for iTunes in python and actually i'm having quite a hard time getting the API information.
I'm using the win32com.client module but i would really need to get all the specifications, methods and details.
There are a few examples but I need some extra data......
thanks!!!
iTunes com interface documentation is available at http://developer.apple.com/sdk/itunescomsdk.html
I know it has been a long time since this question was asked. But I find out some resource for later reference.
REST API:
https://developer.apple.com/documentation/appstoreconnectapi/
Python Wrapper:
https://pypi.org/project/appstoreconnect
Run dir(my_com_client) to get a list of available methods.
Here's a Python library to access iTunes API: http://pypi.python.org/pypi/python-itunes/1.0

Would it be a good idea or bad idea to connect a VB.NET frontend with a Python backend using sockets?

I have some really nice Python code to do what I need to do. I don't particularly like any of the Python GUI choices though. wxPython is nice, but for what I need, the speed on resizing, refreshing and dynamically adding controls just isn't there. I would like to create the GUI in VB.NET. I imagine I could use IronPython to link the two, but that creates a dependency on a rather large third-party product. I was perusing the MSDN documentation on Windows IPC and got the idea to use sockets. I copied the Python echo server code from the Python documentation and in under 5 minutes was able to create a client in VB.NET without even reading the System.Net.Sockets documentation, so this certainly doesn't seem too hard.
The question I have is... is this a terrible idea? If so, what should I be doing instead?
If this is a good idea, how do I go about it?
It's not a terrible idea. In fact, if you write the Python code to have a RESTful interface, and then access that from VB.NET, it is a downright good idea. Later on you could reuse that Python server from any other application written in Python or VB.NET or something else. Because REST is standard and easy to test, people can even do GETs from a browser and maybe that will be useful in itself.
Here is a Yahoo page that gives you code examples to do REST GET, POST and so on, in VB.NET.
If you think REST has too much overhead and need something more lightweight, please don't try to invent your own protocol. Consider something like Google's Protocol Buffers which can also be used from VB.NET.
I think this is an excellent idea. I'll second Michael Dillon's recommendation for a REST API, and I'll further recommend that you use Django to implement your REST server.
I wrote a REST web service using Django, and Django made it really easy and fun. Django made it really simple to set up the URLs the way I wanted them, to run whatever code a URL called for, and to interact with the database as needed. My web service was rock solid reliable, and I was able to test it for debugging simply using a web browser.
If you already have your code working in Python and just want to slap on a glue interface, and if REST doesn't seem like what you want, you could look at the Twisted networking framework. Here is a nice article on how to do networking in Python with both the standard Python modules and with Twisted.

python html integration

this is a complete n00b question and i understand i may get voted down for asking this but i am totally confused over python's html integration.
as i understand one way to integrate python with html code is by using mod_python.
now, is there any other way or method that is more effective for using python with html?
please advise me on this as i am new to learning python and could use some help.
some pointers to code samples would be highly appreciated.
thanks a lot.
EDIT: also what i would like to know is, how does PyHP and mod_python compare with regards to each other. i mean how are they different? and Django? what is Django all about?
I would suggest you to start with web.py
You can read a tutorial on how to use Python in the web.
http://docs.python.org/howto/webservers.html
In few words, mod_python keeps python interpreter in memory ready to execute python scripts, which is faster than launching it every time. It doesn't let you integrate python in html like PHP. For this you need to use a special application, like PyHP (http://www.pyhp.org) or another (there are several of them). Read Python tutorial and documentation pages, there's plenty of info and links to many template and html-embedding engines.
Such engines as PyHP require some overhead to run. Without them, your python application must output HTTP response headers and the page as strings. Mod_wsgi and fastcgi facilitate this process. The page I linked in the beginning gives a good overview on that.
Also you may try Tornado, a python web server, if you don't need to stick to Apache.
The standard way for Python web apps to talk to a webserver is WSGI. Also check out WebOb.
http://www.wsgi.org/wsgi/
http://pythonpaste.org/webob/
But for a complete noob I'd start with a complete web-framework (in which case you typically can ignore the links above). Django or Grok are both full-stack framworks that are easy to use and learn. Django is more popular, but Grok is built on 13 years of Web application publishing experience, and is seriously cool. The difference is a matter of taste.
http://django.org/
http://grok.zope.org/
If you want something more minimalistic, the worlds your oyster, there are an infinite amount of web frameworks for Python, from BFG to Turbogears.

Google Web Toolkit like application in Django

I'm trying to develop an application that would be perfect for GWT, however I am using this app as a learning example for Django. Is there some precedence for this type of application in Django?
Pyjamas is sort of like GWT which is written with Python. From there you can make it work with your django code.
Lots of people have done this by writing their UI in GWT and having it issue ajax calls back to their python backend. There are basically two ways to go about it. First, you can simply use JSON to communicate between the frontend and the backend. That's the approach you will find here (http://palantar.blogspot.com/2006/06/agad-tutorial-ish-sort-of-post.html). Second, some people want to use GWT's RPC system to talk to python backends. This is a little more involved, but some people have created tools (for example, http://code.google.com/p/python-gwt-rpc/).
To be honest, most successful projects just use JSON to communicate between GWT and the python server. GWT's RPC is pretty advanced in that it is able to serialize arbitrary java object graphs to and from the client. It's a tricky problem to get right and I'm pretty doubtful that any of the python tools have it right.

Categories