Connecting a Desktop App to a Web App

Daniel Fetchinson fetchinson at googlemail.com
Mon Jun 23 19:00:29 EDT 2008


>>> Okay, well I wouldn't be creating the app, so, any hints on how to
>>> figure out the API of a web app I don't know super well?
>>
>> Is it something like google, youtube, facebook, etc? These have
>> publicly available API specifications.
>>
>> If it's just a random website without a well maintained public API you
>> would look at the html source of the upload page and see what
>> name:value pairs are sent along with the file from the form that does
>> the upload. Then you would create such a POST request from python.
>>
>> Cheers,
>> Daniel
>> --
>> Psss, psss, put it down! - http://www.cafepress.com/putitdown


> Okay, well I looked into it a little more, and found out that this
> site already has an upload client so I am not going to make this.
> Instead something I really have wanted to figure out for a while would
> be an app where the user inputs a series of words and then they are
> submitted into dictionary.com or something like that and then the
> definitions are returned. How would you suggest going about this?

Please keep the discussion on the list.

You would go to dictionary.com, see (1) how the words are entered by a
user who is using a web browser, what the names are of each field the
browser is submitting, then (2) look at the returned html page and see
how the actual definition is embedded in there. Then from your
knowledge of (1) you would create an appropriate http request in
python, send it to dictionary.com, get the response and once you know
(2) you write a parser (using elementtree for example) that parses the
response and gets your definition.

HTH,
Daniel
-- 
Psss, psss, put it down! - http://www.cafepress.com/putitdown



More information about the Python-list mailing list