开发者

Python Desktop Program Using Web APIs

I have a very random request from a client wanting a desktop based program that can retrieve information from web based APIs such as Google Analytics, SEOMoz and other similar services. They then want parts or all of these results stored in a central location. They have said they DO NOT want a web application at all, but they do want the ability to have the data stored on a "server" (read, server version of the desktop client) on their LAN. The program should be able to run on Windows. Linux and OS X support would be nice.

I have some programming experience and am semi-familiar with Python so I was thinking about using it. My problem is that I am unsure about the communication between clients/servers on the LAN and the communication between the client and web based APIs.

1) Is this even possible? If so, what are good places to look for resources on the API开发者_StackOverflow社区 integration and network communication/any good examples?

2) Any suggestions/tips on what to look out for (e.g, common mistakes, major security issues)?

3) Any ways that would be better than what I have outlined above?

4) Database, what would be good options? I would like to make this as independent as possible and more or less self contained (relying on a minimal amount of installed software).

Thanks for any and all input!


  1. yes, urllib, urllib2 and urlparse are the core python libs for reading to/from urls. I would suggest PyQt for the gui framework (pyGTK, wxWidgets and tkinter would be fine also, they all run fine on the three os's you've mentioned). PyQt includes everything you would need, without reaching into any other library. It includes network access controls, QUrl for url parsing and construction and plenty of GUI tools for displaying the data.

  2. nothing out of the norm, except see [1] in 4

  3. see 1 about PyQt. But what you're going to end up doing is crafting the urls you want to access (including all get/post parameters), sending the data, listening for the data, parse data, place in db. Client would just query db, get results, filtering/ordering/management would be done in the gui code. QtDeclarative might be a good choice for allowing users to craft their own queries (Thought of but never implemented this yet), which you can execute too.

  4. I would suggest postgres, mysql, or any db, relational or not (see mongodb, but don't think PyQt supports it yet, but you can use any python lib with pyqt nicely). Then you can store the data there, have the clients query it and have a client sit on the server, that has extra functionality to query the sites and insert the data Though this might be better served as cli tool that gets the data and inserts into the db (so you can run it on a cron job if wanted).

You would only need to develop the client code and database schema. [1] Remember db's can have multiple clients and users directly connect to a database server. The only real caveat is configuring the server to listen only on the lan to receive the client, and the users permissions are set correctly. This is just cosmetically different from connecting a webapp to the db. You're just granting more users and clients access.

Your biggest problem should be figuring out how to deal with the tediousness of GUI Programming :P

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜