Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #75122

回复: how to download special range content with requests in python?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <1248283536@qq.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status UNSURE 0.224
X-Spam-Level **
X-Spam-Evidence '*H*': 0.56; '*S*': 0.00; 'preferably': 0.05; 'http': 0.09; 'cc:addr:python-list': 0.11; '23,': 0.16; '8bit%:32': 0.16; 'method;': 0.16; 'read()': 0.16; 'received:14': 0.16; 'subject:download': 0.16; 'subject:requests': 0.16; 'url:debian': 0.16; 'url:iso': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'module': 0.19; 'trying': 0.19; 'import': 0.22; 'python?': 0.22; 'cc:addr:python.org': 0.22; 'sends': 0.24; 'file.': 0.24; 'cc:2**0': 0.24; '&gt;': 0.26; 'skip:" 40': 0.26; 'url:edu': 0.26; 'header:In-Reply-To:1': 0.27; 'url:mailman': 0.30; 'requests': 0.31; 'request,': 0.31; 'file': 0.32; 'url:python': 0.33; 'level.': 0.33; 'subject:with': 0.35; 'case,': 0.35; 'url:listinfo': 0.36; 'subject:?': 0.36; 'url:org': 0.36; 'skip:- 20': 0.37; 'server': 0.38; 'skip:- 10': 0.38; 'pm,': 0.38; 'explain': 0.39; 'url:mail': 0.40; 'how': 0.40; 'read': 0.60; 'skip:2 20': 0.60; 'range': 0.61; 'from:charset:utf-8': 0.61; "you're": 0.61; 'first': 0.61; 'you.': 0.62; 're:': 0.63; 'happen': 0.63; 'talking': 0.65; 'to:addr:gmail.com': 0.65; 'url:0': 0.67; 'incorporate': 0.68; 'skip:r 30': 0.69; '8bit%:92': 0.71; 'subjectcharset:utf-8': 0.72; 'skip:a 40': 0.72; 'cut': 0.74; 'further,': 0.74; 'jul': 0.74; 'special': 0.74; 'ball,': 0.84; 'from:addr:1248283536': 0.84; 'from:addr:qq.com': 0.84; 'message-id:@qq.com': 0.84; 'received:qq.com': 0.84; 'skip:\xe6 20': 0.84; 'x-mailer:qqmail 2.x': 0.84; '\xe2\x80\x8d': 0.84; '8bit%:67': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201307; t=1406173955; bh=jZS1/J1FWdhJKUT1MTHKadFdLQor8k1SkNWV6/E2elI=; h=X-QQ-FEAT:X-QQ-SSF:X-HAS-ATTACH:X-QQ-BUSINESS-ORIGIN: X-Originating-IP:In-Reply-To:References:X-QQ-STYLE:X-QQ-mid:From:To:Cc:Subject:Mime-Version:Content-Type:Content-Transfer-Encoding:Date: X-Priority:Message-ID:X-QQ-MIME:X-Mailer:X-QQ-Mailer: X-QQ-ReplyHash:X-QQ-SENDSIZE:X-QQ-FName:X-QQ-LocalIP; b=W7BjOgPpvIjJEMwPz4/CMZ0AEz/d/aLev5gnf7Vn09JTUCLHLI2SJ7KD+RiJfEJKk us85brwQuWWD7XNpFyeeqkyGKuiq7HlXVEReTickWOwM2SdGVqBeFpXOp0oN/0K+pb XovErBxz/wyEfP0Nj5LWn5rL4iosVgf9iFm8LtRU=
X-QQ-FEAT zaIfg0hwV2qzpTqH4CVqkC/tg3F1tCYUGgUIYxQd4MU=
X-QQ-SSF 00010000000000F000000000000000D
X-HAS-ATTACH no
X-QQ-BUSINESS-ORIGIN 2
X-Originating-IP 221.182.18.2
In-Reply-To <CAPTjJmpmUYD3N1vgJmJfXxJ=Vcs3f3MNpPDMnByL5GDxYkEOrQ@mail.gmail.com>
References <tencent_11DB8BA910751CAB361D6B09@qq.com> <CAPTjJmpmUYD3N1vgJmJfXxJ=Vcs3f3MNpPDMnByL5GDxYkEOrQ@mail.gmail.com>
X-QQ-STYLE
X-QQ-mid webmail603t1406172094t3275180
From "水静流深" <1248283536@qq.com>
To "Chris Angelico" <rosuav@gmail.com>
Subject 回复: how to download special range content with requests in python?
Mime-Version 1.0
Content-Type multipart/alternative; boundary="----=_NextPart_53D07BBE_090EB9B0_58898B49"
Content-Transfer-Encoding 8Bit
Date Thu, 24 Jul 2014 11:21:34 +0800
X-Priority 3
X-QQ-MIME TCMime 1.0 by Tencent
X-Mailer QQMail 2.x
X-QQ-Mailer QQMail 2.x
X-QQ-ReplyHash 2131075254
X-QQ-SENDSIZE 520
X-QQ-FName 9365FC3C28FA49B3A4D7A2F270274ECD
X-QQ-LocalIP 163.177.66.155
X-Mailman-Approved-At Thu, 24 Jul 2014 07:02:48 +0200
Cc python-list <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.12264.1406178169.18130.python-list@python.org> (permalink)
Lines 82
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1406178169 news.xs4all.nl 2880 [2001:888:2000:d::a6]:35842
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:75122

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

i want to write a multiple threads download program to practice my  MT knowledge, 
1)cut the big iso file into 20 parts
2)start 20 process with threading and queue module to download
3)combine the 20 parts into one iso file.

if i have cut it into 20 parts ,how can i download the first part of it ?

it is target to practice the threading and queue module .  ‍


------------------ 原始邮件 ------------------
发件人: "Chris Angelico";<rosuav@gmail.com>;
发送时间: 2014年7月23日(星期三) 晚上11:58
收件人: 
抄送: "python-list"<python-list@python.org>; 
主题: Re: how to download special range content with requests in python?



On Wed, Jul 23, 2014 at 7:44 PM, 水静流深 <1248283536@qq.com> wrote:
> url='http://debian.cites.illinois.edu/pub/debian-cd/7.6.0/amd64/iso-cd/debian-7.6.0-amd64-CD-1.iso'
> import requests
> r = requests.get(url).read(0,1000)  ‍
>
> why i can not download special range(from 0 to 10000)  content with requests
> in python‍?

Looking into my crystal ball, I think you're trying to have this send
the Range header. If that's the case, then there's no way you can do
that with the read() method; you have to incorporate that into the
original request, and then just read everything the server sends you.

If that's not what you're talking about, please explain further,
preferably demonstrating what you want to happen at the HTTP level.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

回复: how to download special range content with requests in python? "水静流深" <1248283536@qq.com> - 2014-07-24 11:21 +0800

csiph-web