C2DM Python framework - python

I need to implement client notification for android and I thought to use c2dm.
Is there any framework for c2dm in python ? Does anybody have experience with server side c2dm in python ?

I don't know of an existing library, but I also recently searched how to send notifications to my droid using Python, and I came throuht this blog post which explains how C2DM works and gives a sample Python implementation. I didn't test it yet, but I believe it could be useful as a base at least.
EDIT:
There is also this site which offers the ability to send C2DM notifications to your droid via their servers using an API, and there's even a python library to access it more easily.
EDIT 2:
To use NotifyMyAndroid, it seems you have to install their software on your phone (of I didn't understand how it works ^^)

Related

What is apple's preference for connecting ios apps to python code?

I've developed a cool thing in python that does some simple data manipulation and a bit of machine learning stuff based on user inputs. I'd like to develop an ios app for it, and from what I've read, that app should be in swift as much as possible. I'd like to keep the 'brains' of the app in python on a server so I can develop multiple interfaces to it (a website, possibly an android app as well, a chrome/safari extension).
My app could just be a shortcut to the mobile version of the website, but from what I've read, I can make a better product by writing a custom app for ios.
Can anyone point me to resources describing the most apple-approved way of letting a swift app communicate with a server that hosts a python back end?
welcome to StackOverflow!
iOS does not make a distinction whether the server runs PHP, Python, Java, JS/Node or whatever. All you need is network communication. The easiest way to start would be to simply use HTTPS (it needs to be SSL secured, if you do HTTP requests Apple will reject your app in review).
Apple gives you some tools directly in Swift. All you need should be covered by URLSession: https://developer.apple.com/documentation/foundation/urlsession
There is also a nice tutorial on RayWenderlich: https://www.raywenderlich.com/567-urlsession-tutorial-getting-started
Additional comment:
This of course means you will need to make sure your Python code is available via Network/Internet. A good way to host Python code as a server would be Django (https://www.djangoproject.com/)

Python create an SDK instead just an API

I have a project developed in python/django, i create my API interface for public a view of the db to my clients using POST GET and others calls, all done.
Now i'am wondering what is the best way to create a real SDK for my program, i mean the possibility for my clients, using specific calls, to make my enviroment execute something and return result from their code.
Are there some tools, like for example Django REST framework for the API, also for SDKs?
Thanks at all in advance
API is server side while SDK is client side.
For example, you can provide APIs using python/django. But your customers can use nodejs, C++, C#, JAVA... anything they want to communicate with your server.
If you provide a SDK for C++, that's just for C++ customers. For JAVA customers, you still need to provide another SDK for JAVA.
So in short, you cannot find a cross-language-sdk-generator.

Create python soap server based on wsdl

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.

Bloomberg Server API and Ruby/Python

Im looking to write a new application in ruby/python which uses a feed from bloomberg and am stuck trying to find any documentation for using (or even setting up) Bloomberg Server API with either of these languages.
Does anyone have any good links to tutorials for this or maybe some boilerplate code to get set up? Or is it best to just stick to the three main supported languages?
The Bloomberg Open API (BLPAPI) v3.5 release now includes a native Python SDK.
http://www.openbloomberg.com/2012/11/21/open-api-blpapi-v3-5-x-released/
Did you check out some questions at SO on this. It might help you
Bloomberg API request timing out
Asynchronous data through Bloomberg's new data API (COM v3) with Python?
Resolver is an spreadsheet implementation in IronPython and has a very good integration for Bloomberg API
http://www.resolversystems.com/documentation/apidocs/MarketData_Bloomberg.html
Here is a simple Client access API which I wrote with the help of the mentioned links as well as some others. Not everything is implemented but it is a good start.
https://github.com/bpsmith/pybbg

Python web server?

I want to develop a tool for my project using python. The requirements are:
Embed a web server to let the user get some static files, but the traffic is not very high.
User can configure the tool using http, I don't want a GUI page, I just need a RPC interface, like XML-RPC? or others?
Besides the web server, the tool need some background job to do, so these jobs need to be done with the web server.
So, Which python web server is best choice? I am looking at CherryPy, If you have other recommendation, please write it here.
what about the internal python webserver ?
just type "python web server" in google, and host the 1st result...
Well, I used web frameworks like TurboGears, my current projects are based on Pylons. The last ist fairly easy to learn and both come with CherryPy.
To do some background job you could implement that in pylons too.
Just go to your config/environment.py and see that example:
(I implemented a queue here)
from faxserver.lib.myQueue import start_queue
...
def load_environment(global_conf, app_conf):
...
start_queue()
It depends on your need if you simply use CherryPy or start to use something more complete like Pylons.
Use the WSGI Reference Implementation wsgiref already provided with Python
Use REST protocols with JSON (not XML-RPC). It's simpler and faster than XML.
Background jobs are started with subprocess.
Why dont you use open source build tools (continuous integration tools) like Cruise. Most of them come with a web server/xml interface and sometimes with fancy reports as well.
This sounds like a fun project. So, why don't write your own HTTP server? Its not so complicated after all, HTTP is a well-known and easy to implement protocol and you'll gain a lot of new knowledge!
Check documentation or manual pages (whatever you prefer) of socket(), bind(), listen(), accept() and so on.

Categories

Resources