Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Accessing a URL file Remotely

Reply
Thread Tools

Accessing a URL file Remotely

 
 
mcl
Guest
Posts: n/a
 
      11-29-2007
I have been given a url of CSV file (http://hostname/dir/file.csv),
which when I put the full URL in a web browser shows the contents of
the file.

I want to be able to use the CSV module to read that file, which I
have successfully used with a local CSV file.

Any examples anywhere would be appreciated.

My basic research suggests URLLIB, but I can not find a suitable
example.

I do not understand what additional information, needs to be given to
the remote site in order for it to expose the contents of the file as
though I was reading it locally.

Do I need to copy it to my local machine or can I read it directly
from the remote site.

As you can probably tell, I have never done anything like this, so any
help will be gratefully received.

Thanks

Richard
 
Reply With Quote
 
 
 
 
TheSeeker
Guest
Posts: n/a
 
      11-29-2007
On Nov 29, 3:13 pm, mcl <mcl.off...@googlemail.com> wrote:
> I have been given a url of CSV file (http://hostname/dir/file.csv),
> which when I put the full URL in a web browser shows the contents of
> the file.
>
> I want to be able to use the CSV module to read that file, which I
> have successfully used with a local CSV file.
>
> Any examples anywhere would be appreciated.
>
> My basic research suggests URLLIB, but I can not find a suitable
> example.
>
> I do not understand what additional information, needs to be given to
> the remote site in order for it to expose the contents of the file as
> though I was reading it locally.
>
> Do I need to copy it to my local machine or can I read it directly
> from the remote site.
>
> As you can probably tell, I have never done anything like this, so any
> help will be gratefully received.
>
> Thanks
>
> Richard


-----untested------

import urllib, csv

fp_page = urllib.urlopen("http://URL_of_file")
reader = csv.reader(fp_page)
for row in reader:
print row

Duane
 
Reply With Quote
 
 
 
 
mcl
Guest
Posts: n/a
 
      11-30-2007
On 29 Nov, 22:32, TheSeeker <duane.kauf...@gmail.com> wrote:
> On Nov 29, 3:13 pm, mcl <mcl.off...@googlemail.com> wrote:
>
>
>
> > I have been given a url ofCSVfile (http://hostname/dir/file.csv),
> > which when I put the full URL in a web browser shows the contents of
> > the file.

>
> > I want to be able to use theCSVmodule to read that file, which I
> > have successfully used with a localCSVfile.

>
> > Any examples anywhere would be appreciated.

>
> > My basic research suggests URLLIB, but I can not find a suitable
> > example.

>
> > I do not understand what additional information, needs to be given to
> > the remote site in order for it to expose the contents of the file as
> > though I was reading it locally.

>
> > Do I need to copy it to my local machine or can I read it directly
> > from the remote site.

>
> > As you can probably tell, I have never done anything like this, so any
> > help will be gratefully received.

>
> > Thanks

>
> > Richard

>
> -----untested------
>
> import urllib,csv
>
> fp_page = urllib.urlopen("http://URL_of_file")
> reader =csv.reader(fp_page)
> for row in reader:
> print row
>
> Duane


Duane,

Brilliant - I had fears of much more complication.

Thank you very much

Richard

 
Reply With Quote
 
Grant Edwards
Guest
Posts: n/a
 
      11-30-2007
On 2007-11-30, mcl <> wrote:

> Brilliant - I had fears of much more complication.


I've been writing Python programs for almost 10 years, and I
still have that reaction not infrequently.

--
Grant Edwards grante Yow! I like the way ONLY
at their mouths move ... They
visi.com look like DYING OYSTERS
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing hosted SQL remotely eric302@gmail.com ASP .Net 5 07-23-2007 05:45 AM
Issue in accessing vb.net application remotely rshapse@gmail.com ASP .Net 0 03-16-2007 10:31 AM
remotely accessing my pc Kendra Kay Computer Support 9 12-27-2004 05:42 AM
Accessing email remotely °Mike° Computer Support 4 09-14-2003 10:00 PM
Application Accessing MySQL remotely Ike Java 1 09-12-2003 06:10 PM



Advertisments