473,473 Members | 1,672 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

using urllib with ftp?

I've tried this already and it seems to work, but I'm curious if it's
okay to use urllib when trying to access a url that begins with ftp://
instead of http://. Does this matter? It's only a text file, so it's not
really an FTP server I'm accessing, I don't think. I wasn't sure if
using ftplib would be overkill in this case, or if you even could use it
at all if you just want to get the page itself (the txt file).

Thanks.
May 4 '06 #1
4 2249
John Salerno wrote:
I've tried this already and it seems to work, but I'm curious if it's
okay to use urllib when trying to access a url that begins with ftp://
instead of http://. Does this matter? It's only a text file, so it's not
really an FTP server I'm accessing, I don't think. I wasn't sure if
using ftplib would be overkill in this case, or if you even could use it
at all if you just want to get the page itself (the txt file).


from the urllib documentation:

Currently, only the following protocols are supported: HTTP,
(versions 0.9 and 1.0), Gopher (but not Gopher-+), FTP, and
local files.

</F>

May 4 '06 #2
Fredrik Lundh wrote:
John Salerno wrote:
I've tried this already and it seems to work, but I'm curious if it's
okay to use urllib when trying to access a url that begins with ftp://
instead of http://. Does this matter? It's only a text file, so it's not
really an FTP server I'm accessing, I don't think. I wasn't sure if
using ftplib would be overkill in this case, or if you even could use it
at all if you just want to get the page itself (the txt file).


from the urllib documentation:

Currently, only the following protocols are supported: HTTP,
(versions 0.9 and 1.0), Gopher (but not Gopher-+), FTP, and
local files.


Thanks. So the ftp:// is something different than actually using ftplib
to connect to an FTP server, right? I've used both urllib and ftplib, so
I know what they do, I just was a little unclear about whether they can
sometimes do each other's work as well.
May 5 '06 #3
John Salerno wrote:
Thanks. So the ftp:// is something different than actually using ftplib
to connect to an FTP server, right? I've used both urllib and ftplib, so
I know what they do, I just was a little unclear about whether they can
sometimes do each other's work as well.


urllib uses ftplib under the hood, but all you can do is to fetch files or directory
listings.

</F>

May 5 '06 #4
Fredrik Lundh wrote:
John Salerno wrote:
Thanks. So the ftp:// is something different than actually using ftplib
to connect to an FTP server, right? I've used both urllib and ftplib, so
I know what they do, I just was a little unclear about whether they can
sometimes do each other's work as well.


urllib uses ftplib under the hood, but all you can do is to fetch files or directory
listings.


Thanks! That makes perfect sense now that I know that.
May 5 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Richard Shea | last post by:
Hi - I'm new to Python. I've been trying to use URLLIB and the 'tidy' function (part of the mx.tidy package). There's one thing I'm having real difficulties understanding. When I did this ... ...
1
by: Steve Allgood | last post by:
I'm having trouble posting a form at the USPS web site. I've been successful using urllib at other sites, but I'm missing why this won't work: # begin code # get zip+4 import urllib def...
8
by: bmgx | last post by:
I would like to use an already existing online service (currency converter) basically consisting of a html form with a few options that is submitted and returns the results. I really don't know...
11
by: Pater Maximus | last post by:
I am trying to implement the recipe listed at http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/211886 However, I can not get to first base. When I try to run import urllib...
0
by: Shane Hathaway | last post by:
I started experimenting with SOAPpy yesterday and immediately hit a snag. Both web services I tried simply hung and never replied. After a lot of digging, I found out what was going wrong:...
0
by: Pieter Edelman | last post by:
Hi all, I'm trying to submit some data using a POST request to a HTTP server with BASIC authentication with python, but I can't get it to work. Since it's driving me completely nuts, so here's...
6
by: justsee | last post by:
Hi, I'm using Python 2.3 on Windows for the first time, and am doing something wrong in using urllib to retrieve images from urls embedded in a csv file. If I explicitly specify a url and image...
1
by: onceuponapriori | last post by:
Greetings gents. I'm a Railser working on a django app that needs to do some scraping to gather its data. I need to programatically access a site that requires a username and password. Once I...
4
by: kgrafals | last post by:
Hi, I'm just trying to read from a webpage with urllib but I'm getting IOErrors. This is my code: import urllib sock = urllib.urlopen("http://www.google.com/") and this is the error:
1
by: jmalone | last post by:
I have a python script that I need to freeze on AIX 5.1 (customer has AIX and does not want to install Python). The python script is pretty simple (the only things it imports are sys and socket)....
0
marktang
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,...
0
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...
0
Oralloy
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,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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...
0
agi2029
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.