Re: retrieve data using FTP in Python

2005-09-14 Thread Jaime Wyant
Try this from the interpreter:

import ftplib
help(ftplib)

The module is pretty easy to use.  If you'll be doing anything with
`http', then visit urllib2:

import urllib2
help(urllib2)

I think urllib2 will take `ftp' urls:
ftp://user:[EMAIL PROTECTED]/dir/file_to_get

hth,
jw
On 9/13/05, swarna pulavarty <[EMAIL PROTECTED]> wrote:
>  
> Hi all, 
>   
> I am new to this Python group and to Python . I need to retrieve data from
> an arbitrary URL and save it to a file. 
> Can anyone tell me how to retrieve "any" data using FTP modules in Python ?
> And also, Can you suggest me some books and online references to get
> familiar with Python and especially FTP modules in Python ?  
>   
> Your help is appreciated ! 
>   
> Swarna.
> 
>  
>  Yahoo! India Matrimony: Find your partner now. 
> 
> 
> --
> http://mail.python.org/mailman/listinfo/python-list
> 
>
-- 
http://mail.python.org/mailman/listinfo/python-list


retrieve data using FTP in Python

2005-09-14 Thread swarna pulavarty

Hi all, 
 
I am new to this Python group and to Python . I need to retrieve data from an arbitrary URL and save it to a file.
Can anyone tell me how to retrieve "any" data using FTP modules in Python ? And also, Can you suggest me some books and online references to get familiar with Python and especially FTP modules in Python ? 
 
Your help is appreciated !
 
Swarna.
		 
Yahoo! India Matrimony: Find your partner now.-- 
http://mail.python.org/mailman/listinfo/python-list

Re: retrieve data using FTP in Python

2005-09-13 Thread Fredrik Lundh
"swarna pulavarty" wrote:

> I am new to this Python group and to Python . I need to retrieve data
> from an arbitrary URL and save it to a file.

if you have an URL, you can use the urllib module:

urllib.urlretrieve(url, filename)

> Can anyone tell me how to retrieve "any" data using FTP modules in
> Python ? And also, Can you suggest me some books and online references
> to get familiar with Python and especially FTP modules in Python ?

for python, start here:

http://wiki.python.org/moin/BeginnersGuide

for ftplib, see e.g.

http://www.python.org/doc/2.4/lib/module-ftplib.html
http://effbot.org/librarybook/ftplib.htm





-- 
http://mail.python.org/mailman/listinfo/python-list


Re: retrieve data using FTP in Python

2005-09-13 Thread Steve Holden
swarna pulavarty wrote:
> Hi all,
>  
> I am new to this Python group and to Python . I need to retrieve data 
> from an arbitrary URL and save it to a file.
> Can anyone tell me how to retrieve "any" data using FTP modules in 
> Python ? And also, Can you suggest me some books and online references 
> to get familiar with Python and especially FTP modules in Python ? 
>  
> Your help is appreciated !
>  
Swana:

If you need to handle arbitrary URLs then you need either urllib or 
urllib2, both components of the standard library. See

   http://docs.python.org/lib/module-urllib.html and
   http://docs.python.org/lib/module-urllib2.html

I don't use urllib2 much myself, so here's an example from urllib. How 
much easier can this be?

$ python
Python 2.4.1 (#1, May 27 2005, 18:02:40)
[GCC 3.3.3 (cygwin special)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
  >>> import urllib
  >>> f = urllib.urlopen("http://www.holdenweb.com/";)
  >>> dir(f)
['__doc__', '__init__', '__iter__', '__module__', '__repr__', 'close', 
'fileno',
  'fp', 'geturl', 'headers', 'info', 'next', 'read', 'readline', 
'readlines', 'ur
l']
  >>> print f.read()



   ...




  >>> f.headers.keys()
['content-length', 'accept-ranges', 'server', 'last-modified', 
'connection', 'etag', 'date', 'content-type']
  >>> f.headers["content-length"]
'13378'
  >>>

Good luck!

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

-- 
http://mail.python.org/mailman/listinfo/python-list


retrieve data using FTP in Python

2005-09-13 Thread swarna pulavarty
Hi all, 
 
I am new to this Python group and to Python . I need to retrieve data from an arbitrary URL and save it to a file.
Can anyone tell me how to retrieve "any" data using FTP modules in Python ? And also, Can you suggest me some books and online references to get familiar with Python and especially FTP modules in Python ? 
 
Your help is appreciated !
 
Swarna.
		 
Yahoo! India Matrimony: Find your partner now.-- 
http://mail.python.org/mailman/listinfo/python-list