How to call wget by python ?

Discussion in 'Python' started by iMath, Jan 10, 2013.

  1. iMath

    iMath Guest

    can you give me an example code ?
     
    iMath, Jan 10, 2013
    #1
    1. Advertising

  2. On Thu, Jan 10, 2013 at 1:11 PM, iMath <> wrote:
    > can you give me an example code ?
    > --
    > http://mail.python.org/mailman/listinfo/python-list


    You've asked several very vague questions. I would strongly recommend
    that you read this:

    http://www.catb.org/esr/faqs/smart-questions.html

    Invoking wget can be done, but you may want to consider alternatives
    such as doing the network request (HTTP, FTP, or whatever) directly in
    Python. A one-line request that we do heaps of work for you is not the
    best way to get results.

    ChrisA
     
    Chris Angelico, Jan 10, 2013
    #2
    1. Advertising

  3. On 01/09/2013 07:11 PM, iMath wrote:
    > can you give me an example code ?


    No but I can suggest some alternative ideas, such as using httplib
    (built into python), or libcurl. Or if you have to use wget, you run it
    the same way you run any external command from python. If it were my
    I'd plunk a few search terms in google, such as "python run external
    process."
     
    Michael Torrie, Jan 10, 2013
    #3
  4. Michael Torrieæ–¼ 2013å¹´1月10日星期四UTC+8上åˆ11時04分31秒寫é“:
    > On 01/09/2013 07:11 PM, iMath wrote:
    >
    > > can you give me an example code ?

    >
    >
    >
    > No but I can suggest some alternative ideas, such as using httplib
    >
    > (built into python), or libcurl. Or if you have to use wget, you run it
    >
    > the same way you run any external command from python. If it were my
    >
    > I'd plunk a few search terms in google, such as "python run external
    >
    > process."


    Inherantly the python interpreter has a GC builtin
    to use pacakages like DLL by reference counting.
     
    88888 Dihedral, Jan 10, 2013
    #4
  5. Michael Torrieæ–¼ 2013å¹´1月10日星期四UTC+8上åˆ11時04分31秒寫é“:
    > On 01/09/2013 07:11 PM, iMath wrote:
    >
    > > can you give me an example code ?

    >
    >
    >
    > No but I can suggest some alternative ideas, such as using httplib
    >
    > (built into python), or libcurl. Or if you have to use wget, you run it
    >
    > the same way you run any external command from python. If it were my
    >
    > I'd plunk a few search terms in google, such as "python run external
    >
    > process."


    Inherantly the python interpreter has a GC builtin
    to use pacakages like DLL by reference counting.
     
    88888 Dihedral, Jan 10, 2013
    #5
  6. On Thu, Jan 10, 2013 at 2:21 PM, 88888 Dihedral
    <> wrote:
    > Inherantly the python interpreter has a GC builtin
    > to use pacakages like DLL by reference counting.


    That almost makes sense. And it's almost profound, too.

    ChrisA
     
    Chris Angelico, Jan 10, 2013
    #6
  7. On Wed, 09 Jan 2013 18:11:34 -0800, iMath wrote:

    > can you give me an example code ?


    Is the web broken where you are? If you google for "python wget", you
    will find example of how to call wget as an external process, as well as
    examples of downloading files from the web like wget would do but using
    only Python.

    https://duckduckgo.com/?q=python wget


    Or you could search for "python call external command" and then use wget
    as that external command.

    https://duckduckgo.com/?q=python call external command



    --
    Steven
     
    Steven D'Aprano, Jan 10, 2013
    #7
  8. iMath

    Guest

    On Wednesday, January 9, 2013 7:11:34 PM UTC-7, iMath wrote:
    > can you give me an example code ?


    For running any system command from Python, you can use the
    subprocess module:
    http://docs.python.org/3/library/subprocess.html#module-subprocess

    To run "wget -p -k http://python.org" from Python you could
    do something like this:

    import subprocess
    subprocess.call (['wget', '-p', '-k', 'http://python.org'])
     
    , Jan 10, 2013
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Robert P. J. Day
    Replies:
    2
    Views:
    411
    Robert P. J. Day
    Dec 16, 2004
  2. olivier HARO

    a simple wget in C language?

    olivier HARO, Oct 14, 2004, in forum: C Programming
    Replies:
    10
    Views:
    1,691
    Ilja Booij
    Nov 3, 2004
  3. Yang
    Replies:
    6
    Views:
    3,829
  4. Robert Dailey

    Equivalent of 'wget' for python?

    Robert Dailey, Dec 8, 2008, in forum: Python
    Replies:
    5
    Views:
    34,348
    member thudfoo
    Dec 11, 2008
  5. hrishy
    Replies:
    3
    Views:
    1,561
Loading...

Share This Page