using urllib with ftp?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Salerno

    #1

    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.
  • Fredrik Lundh

    #2
    Re: using urllib with ftp?

    John Salerno wrote:
    [color=blue]
    > 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).[/color]

    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>



    Comment

    • John Salerno

      #3
      Re: using urllib with ftp?

      Fredrik Lundh wrote:[color=blue]
      > John Salerno wrote:
      >[color=green]
      >> 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).[/color]
      >
      > 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.[/color]

      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.

      Comment

      • Fredrik Lundh

        #4
        Re: using urllib with ftp?

        John Salerno wrote:
        [color=blue]
        > 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.[/color]

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

        </F>



        Comment

        • John Salerno

          #5
          Re: using urllib with ftp?

          Fredrik Lundh wrote:[color=blue]
          > John Salerno wrote:
          >[color=green]
          >> 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.[/color]
          >
          > urllib uses ftplib under the hood, but all you can do is to fetch files or directory
          > listings.[/color]

          Thanks! That makes perfect sense now that I know that.

          Comment

          Working...