how to call basic browser functions?
BLElliott
belliott4488 at comcast.net
Sat Nov 5 12:46:31 EST 2005
Great! I've never looked in to the urllibs before, but it sounds like
they're just what I need. And no, I'm not thinking of anything so
sophisticated as executing applets or anything -- just those "Save * as
..." functions, where * might be "page", "image", "link target" etc.
I also hadn't known about wget, so that's good to know, too.
thanks!
- bruce
Peter Hansen wrote:
> BLElliott wrote:
>
>> I think this is a very basic question, so feel free to direct me to a
>> FAQ or other resource to go and get myself educated, if that's the
>> best answer.
>>
>> Can I perform web browser functions from a script, for example, doing
>> file downloads, if I can construct the file URL within my script? As
>> an example, suppose there's a file I download periodically, but its
>> URL changes with the current date. If I can write a script that will
>> automatically generate the URL, can it then go and fetch the file for me?
>
>
> Yes, you can definitely do that. Look for examples of using "urllib" or
> "urllib2". There should be many that are close to the sort of thing you
> want. Or you could simply use a command line utility such as "wget" to
> accomplish much the same thing and avoid almost any programming.
>
> (Note that if in addition to downloading the actual contents of the
> page, you will require more sophisticated features of a real browser,
> such as Javascript or Java execution, you'll need capabilities far
> beyond what urllib2 can provide. And you probably don't want to go
> there right now.)
>
> -Peter
More information about the Python-list
mailing list