[EMAIL PROTECTED] schrieb:
> My TurboGears app needs to grab stock info from a
> remote site.

Ok, so this does not touch anything special to TurboGears at all. You want to
act as the client to some third-party web application. TurboGears does not
offer you help with is, since it is geared (pun happily accepted) towards
_offering_ web services, not using them.

So, you basically take the same approach as you would take, if you were writing
a standalone client. And yes, mechanize might be a good option for that, though
sometimes the urllib module from the standard library is sufficient.

> This requires that TurboGears
> 
>                 1. Do HTTPS login auth part

First, you need to find out, what kind of authentication is used. HTTP
(Basic/Digest) or form-based? In the latter case, can you post the
username/password directly to same URL with which you download the file, or do
you need do a request to a login form first and retrieve a session cookie?

>                 2. Grab file  (likely will involve entering company
> info in a form and clicking submit)

If you can post the username/password directly to the form, just add them to
the other required values (e.g. company name, etc.) and then do a GET/POST
request to the URL stated in the ACTION attribute of the form.

If this is not possible, then using mechanize is probably simpler.

Whichever way you do it, run the download procedure in its own thread, so that
it does not block the response from TurboGears to the browser (unless that is
what you want).


HTH, Chris

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to