Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.052 X-Spam-Evidence: '*H*': 0.90; '*S*': 0.00; 'preferably': 0.05; 'http': 0.09; 'cc:addr:python-list': 0.11; '23,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'method;': 0.16; 'read()': 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; 'trying': 0.19; 'import': 0.22; 'cc:addr:python.org': 0.22; 'sends': 0.24; 'cc:2**0': 0.24; 'url:edu': 0.26; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'requests': 0.31; 'request,': 0.31; 'level.': 0.33; 'subject:with': 0.35; 'case,': 0.35; 'received:google.com': 0.35; 'subject:?': 0.36; 'server': 0.38; 'pm,': 0.38; 'explain': 0.39; 'read': 0.60; 'range': 0.61; "you're": 0.61; 'you.': 0.62; 'happen': 0.63; 'talking': 0.65; 'url:0': 0.67; 'incorporate': 0.68; 'skip:r 30': 0.69; 'further,': 0.74; 'jul': 0.74; 'special': 0.74; 'ball,': 0.84; '\xe2\x80\x8d': 0.84; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type:content-transfer-encoding; bh=DCfgdemAqCSq2mECjTwbvZAc6gRCz4jFjLHhNlw+K6k=; b=ey5uPsFBtuAncDW/eXvJoWBuzA93uSJKl9NPgHpfT6zYVInGZ49LiEsLcWcuKRpkKk T5z/xyW4wbZiY0F7EIaKrlRK4R+9zZd+8Wm0+aQ4/HpZryGVV3eAC2SjgQUcesWAKJQh RHK8zhAF8f/RpNVvaOp1X8O1eA2a5iNNUDVPfSbko1NgDmUPgCRtBp8pwyEiDKLSZzjf zIJTWm7A8k3CTQE9xfgl8gx8d8zXSZ070q/37sScdypEOiR4etG+N7mrHQG7NeHl9JOP u/Q2hL0Ggo6RQ7LEOf+YIflmiceFOO33sE1K55glu+9rBNAjLxNWy88KeOpkXmlnO/Jk lErg== MIME-Version: 1.0 X-Received: by 10.220.81.194 with SMTP id y2mr3382170vck.29.1406131135433; Wed, 23 Jul 2014 08:58:55 -0700 (PDT) In-Reply-To: References: Date: Thu, 24 Jul 2014 01:58:55 +1000 Subject: Re: how to download special range content with requests in python? From: Chris Angelico Cc: python-list Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1406131138 news.xs4all.nl 2948 [2001:888:2000:d::a6]:45680 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:75094 On Wed, Jul 23, 2014 at 7:44 PM, =E6=B0=B4=E9=9D=99=E6=B5=81=E6=B7=B1 <1248= 283536@qq.com> wrote: > url=3D'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 =3D requests.get(url).read(0,1000) =E2=80=8D > > why i can not download special range(from 0 to 10000) content with reque= sts > in python=E2=80=8D? 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