Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #36408 > unrolled thread
| Started by | iMath <redstone-cold@163.com> |
|---|---|
| First post | 2013-01-07 20:19 -0800 |
| Last post | 2013-01-08 15:19 +0000 |
| Articles | 7 — 6 participants |
Back to article view | Back to comp.lang.python
how to download internet files by python ? iMath <redstone-cold@163.com> - 2013-01-07 20:19 -0800
Re: how to download internet files by python ? Cameron Simpson <cs@zip.com.au> - 2013-01-08 15:44 +1100
Re: how to download internet files by python ? Roy Smith <roy@panix.com> - 2013-01-08 00:04 -0500
Re: how to download internet files by python ? iMath <redstone-cold@163.com> - 2013-01-09 18:08 -0800
Re: how to download internet files by python ? Tim Roberts <timr@probo.com> - 2013-01-09 20:31 -0800
Re: how to download internet files by python ? Rodrick Brown <rodrick.brown@gmail.com> - 2013-01-08 00:00 -0500
Re: how to download internet files by python ? MRAB <python@mrabarnett.plus.com> - 2013-01-08 15:19 +0000
| From | iMath <redstone-cold@163.com> |
|---|---|
| Date | 2013-01-07 20:19 -0800 |
| Subject | how to download internet files by python ? |
| Message-ID | <e4fc5450-8816-471f-8f03-ed9229b64602@googlegroups.com> |
for example ,if I want to download this file ,how to implement the download functionality by python ? http://down.51voa.com/201208/se-ed-foreign-students-friends-16aug12.mp3 as for download speed ,of course ,the fast ,the better ,so how to implement it ? It would be better to show me an example :) thanks !!!
[toc] | [next] | [standalone]
| From | Cameron Simpson <cs@zip.com.au> |
|---|---|
| Date | 2013-01-08 15:44 +1100 |
| Message-ID | <mailman.259.1357620254.2939.python-list@python.org> |
| In reply to | #36408 |
On 07Jan2013 20:19, iMath <redstone-cold@163.com> wrote:
| for example ,if I want to download this file ,how to implement the download functionality by python ?
|
| http://down.51voa.com/201208/se-ed-foreign-students-friends-16aug12.mp3
|
| as for download speed ,of course ,the fast ,the better ,so how to implement it ?
| It would be better to show me an example :) thanks !!!
Look at urllib2.
--
Cameron Simpson <cs@zip.com.au>
If God had intended Man to fly, He would have given him more money.
- Jeff Cauhape, cauhape@TWG.COM
[toc] | [prev] | [next] | [standalone]
| From | Roy Smith <roy@panix.com> |
|---|---|
| Date | 2013-01-08 00:04 -0500 |
| Message-ID | <roy-7EBFAF.00045408012013@news.panix.com> |
| In reply to | #36410 |
In article <mailman.259.1357620254.2939.python-list@python.org>, Cameron Simpson <cs@zip.com.au> wrote: > On 07Jan2013 20:19, iMath <redstone-cold@163.com> wrote: > | for example ,if I want to download this file ,how to implement the download > | functionality by python ? > | > | http://down.51voa.com/201208/se-ed-foreign-students-friends-16aug12.mp3 > | > | as for download speed ,of course ,the fast ,the better ,so how to > | implement it ? > | It would be better to show me an example :) thanks !!! > > Look at urllib2. Even better, look at requests (http://docs.python-requests.org/en/latest/). There's nothing you can do with requests that you can't do with urllib2, but the interface is a whole lot easier to work with.
[toc] | [prev] | [next] | [standalone]
| From | iMath <redstone-cold@163.com> |
|---|---|
| Date | 2013-01-09 18:08 -0800 |
| Message-ID | <f9b87258-1600-4ff5-b630-e788a24b68e6@googlegroups.com> |
| In reply to | #36412 |
在 2013年1月8日星期二UTC+8下午1时04分54秒,Roy Smith写道: > In article <mailman.259.1357620254.2939.python-list@python.org>, > > Cameron Simpson <cs@zip.com.au> wrote: > > > > > On 07Jan2013 20:19, iMath <redstone-cold@163.com> wrote: > > > | for example ,if I want to download this file ,how to implement the download > > > | functionality by python ? > > > | > > > | http://down.51voa.com/201208/se-ed-foreign-students-friends-16aug12.mp3 > > > | > > > | as for download speed ,of course ,the fast ,the better ,so how to > > > | implement it ? > > > | It would be better to show me an example :) thanks !!! > > > > > > Look at urllib2. > > > > Even better, look at requests > > (http://docs.python-requests.org/en/latest/). There's nothing you can > > do with requests that you can't do with urllib2, but the interface is a > > whole lot easier to work with. There is also a httplib2 module https://code.google.com/p/httplib2/ which one is more pythonic and powerful ?
[toc] | [prev] | [next] | [standalone]
| From | Tim Roberts <timr@probo.com> |
|---|---|
| Date | 2013-01-09 20:31 -0800 |
| Message-ID | <tugse8dn1omv12nnib504js4qsuks00b63@4ax.com> |
| In reply to | #36544 |
iMath <redstone-cold@163.com> wrote: > >There is also a httplib2 module >https://code.google.com/p/httplib2/ > >which one is more pythonic and powerful ? Both are Pythonic, and power is irrelevant for this. Your code is going to spend 90% of its time waiting for the network. Just solve the problem. -- Tim Roberts, timr@probo.com Providenza & Boekelheide, Inc.
[toc] | [prev] | [next] | [standalone]
| From | Rodrick Brown <rodrick.brown@gmail.com> |
|---|---|
| Date | 2013-01-08 00:00 -0500 |
| Message-ID | <mailman.260.1357621271.2939.python-list@python.org> |
| In reply to | #36408 |
[Multipart message — attachments visible in raw view] — view raw
On Mon, Jan 7, 2013 at 11:19 PM, iMath <redstone-cold@163.com> wrote:
> for example ,if I want to download this file ,how to implement the
> download functionality by python ?
>
> http://down.51voa.com/201208/se-ed-foreign-students-friends-16aug12.mp3
>
> as for download speed ,of course ,the fast ,the better ,so how to
> implement it ?
>
> It would be better to show me an example :) thanks !!!
> --
> http://mail.python.org/mailman/listinfo/python-list
>
#!/usr/bin/python
import urllib2
if __name__ == '__main__':
fileurl='
http://down.51voa.com/201208/se-ed-foreign-students-friends-16aug12.mp3'
mp3file = urllib2.urlopen(fileurl)
with open('outfile.mp3','wb') as output:
output.write(mp3file.read())
[toc] | [prev] | [next] | [standalone]
| From | MRAB <python@mrabarnett.plus.com> |
|---|---|
| Date | 2013-01-08 15:19 +0000 |
| Message-ID | <mailman.279.1357658388.2939.python-list@python.org> |
| In reply to | #36408 |
On 2013-01-08 05:00, Rodrick Brown wrote:
> On Mon, Jan 7, 2013 at 11:19 PM, iMath <redstone-cold@163.com
> <mailto:redstone-cold@163.com>> wrote:
>
> for example ,if I want to download this file ,how to implement the
> download functionality by python ?
>
> http://down.51voa.com/201208/se-ed-foreign-students-friends-16aug12.mp3
>
> as for download speed ,of course ,the fast ,the better ,so how to
> implement it ?
>
> It would be better to show me an example :) thanks !!!
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
> #!/usr/bin/python
> import urllib2
> if __name__ == '__main__':
>
> fileurl='http://down.51voa.com/201208/se-ed-foreign-students-friends-16aug12.mp3'
>
> mp3file = urllib2.urlopen(fileurl)
> with open('outfile.mp3','wb') as output:
> output.write(mp3file.read())
>
Why not just use urlretrieve?
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web