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?
thanks in advance,
Bruce 2 1314
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
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Bruce W...1 |
last post by:
I'm a PHP newbie coming from experience with ASP.NET. I want to have a separate
PHP file to support each HTML PHP page. This would be the equivalent of an
ASP.NET code-behind file but using PHP....
|
by: glm |
last post by:
I'm a web developer (cold fusion, php, access, mySQL). A client would
like for me to build a windows based app for him. I have suggested
that he keep it web-based but he insists that it be...
|
by: Sue |
last post by:
After finishing up my first quarter JavaScript on 12/12/03, I decided
to improve character checking on my project. In my project I only had
to do very basic validation. Therefore, I only had one...
|
by: Mike Qin |
last post by:
Hi there,
Now I'm writing code mainly in C++. And some existing c code
will call some functions which are in a C++ class. I read the basic
techniques introduced from a SUN's web site.
Basically...
|
by: Randell D. |
last post by:
Folks,
I'm sure this can be done legally, and not thru tricks of the trade - I
hope someone can help.
I'm writing a 'tool' (a function) which can be used generically in any
of my projects. ...
|
by: Tim ffitch |
last post by:
Hi
I have created a VB dll file that contains common functions I use
across various projects in VB, Access and Excel. Rather than have to
code the functions in each I decided to use the dll...
|
by: usenet |
last post by:
How and where can one find out about the basics of VB/Access2003
syntax?
I am a died in the wool C/C++/Java Linux/Unix programmer and I am
finding it difficult to understand the program format...
|
by: Steven T. Hatton |
last post by:
I just read §2.11.3 of D&E, and I have to say, I'm quite puzzled by what it
says.
http://java.sun.com/docs/books/tutorial/essential/concurrency/syncrgb.html
<shrug>
--
NOUN:1. Money or...
|
by: Prisoner at War |
last post by:
Okay, Folks,
I guess my real burning concern all along is a "high-level" one: just
how does JavaScript interact with CSS?
Right now, my newbie self only knows JavaScript and CSS to *co-...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |