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


Groups > comp.lang.python > #47962

Re: Must we include urllib just to decode a URL-encoded string, when using Requests?

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <dotancohen@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.010
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'python.': 0.02; 'that?': 0.05; 'subject:string': 0.09; 'subject:using': 0.09; 'url:github': 0.09; 'api': 0.11; 'cc:addr:python-list': 0.11; 'python': 0.11; 'kern': 0.16; 'subject: \n ': 0.16; 'subject:URL': 0.16; 'subject:when': 0.16; 'to:addr:robert.kern': 0.16; 'to:name:robert kern': 0.16; 'urllib': 0.16; 'urllib2,': 0.16; 'using,': 0.16; 'wrote:': 0.18; 'library': 0.18; 'thu,': 0.19; 'thanks.': 0.20; 'import': 0.22; 'cc:addr:python.org': 0.22; 'issue,': 0.24; 'server.': 0.24; 'versions': 0.24; 'cc:2**0': 0.24; 'switch': 0.26; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'robert': 0.30; 'see,': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'requests': 0.31; '13,': 0.31; 'probably': 0.32; 'skip:u 20': 0.35; 'something': 0.35; 'no,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'subject:?': 0.36; 'should': 0.36; 'thank': 0.38; 'stable': 0.38; 'handle': 0.38; 'whatever': 0.38; 'pm,': 0.38; 'rather': 0.38; 'does': 0.39; 'sure': 0.39; 'either': 0.39; 'skip:u 10': 0.60; 'tell': 0.60; 'issues,': 0.61; 'kind': 0.63; 'talking': 0.65; 'to:addr:gmail.com': 0.65; 'between': 0.67; 'url:co': 0.67; 'other.': 0.75; 'yourself': 0.78; 'subject:Must': 0.84; 'url:master': 0.84; 'wrong!': 0.84; 'avoided.': 0.91; '2013': 0.98
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:to :cc:content-type; bh=9A/ZZItRXka7L7+GLtkxgsp7pb8Yv2DwVRSYVUuKiNg=; b=FPH7kTB9iZCGoCKO9p2ckLGHy6oA2hDBPxxIjEmI1AAEgCbQVJ+ZH2OQSaMs2M0N2Y ypntGqjuDUAQa4hf/swpvuzR+PlcwsGlf1oDWysDnoN9i79U69SUoovZ/jz9yTaXQkiV fdmUpkB6KaI/Pd97MuHKE6OxI6dxT5Ktu2sIHEHy+/rL7/5YhcnQXNsT66+8auHHKKvj QMIBc+Ilwh48fMz4Z6YMoY1asXIxLKz1nxUziiS3ysjqeAbrizWiGqcc0DQShWKs0fq8 3TGxGLKl73yKm1SqJCD/X3sgy/pr13Z6NSPDwPLFseeA0leHNixfj57npStQcBxbCai1 Uwlg==
MIME-Version 1.0
X-Received by 10.181.13.106 with SMTP id ex10mr618709wid.16.1371130902083; Thu, 13 Jun 2013 06:41:42 -0700 (PDT)
In-Reply-To <kpchpg$vh1$1@ger.gmane.org>
References <CAKDXFkO6t9dkYTrughGL4DzBfAOypia7w34hkmFAN9xext9TWA@mail.gmail.com> <kpcgvj$m7p$1@ger.gmane.org> <CAKDXFkOYUgb-Sw=MK3SpSNPUAO+ubt248E9KX39aK8T7+=ZcUQ@mail.gmail.com> <kpchpg$vh1$1@ger.gmane.org>
Date Thu, 13 Jun 2013 16:41:42 +0300
Subject Re: Must we include urllib just to decode a URL-encoded string, when using Requests?
From Dotan Cohen <dotancohen@gmail.com>
To Robert Kern <robert.kern@gmail.com>
Content-Type text/plain; charset=UTF-8
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 <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3194.1371131291.3114.python-list@python.org> (permalink)
Lines 35
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1371131291 news.xs4all.nl 15994 [2001:888:2000:d::a6]:52735
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:47962

Show key headers only | View raw


On Thu, Jun 13, 2013 at 4:34 PM, Robert Kern <robert.kern@gmail.com> wrote:
>> I'm pretty sure that Requests will use either urllib or urllib2,
>> depending on what is available on the server.
>
> No, it doesn't. It gets its quote() function from urllib always.
>

I see, thanks. Then that is what I will do as well!

>> I would like to use
>> whatever Requests is currently using, rather than import the other.
>> Can I tell which library Requests is currently using and use that?
>
>
> The only thing I can think that you are talking about is the difference
> between Python 2 and Python 3. In Python 2, it's urllib.quote() and in
> Python 3, it's urllib.parse.quote(), but that's a Python-version issue, not
> something to do with requests, per se. requests does have a compatibility
> layer, internally, that pastes over those issues, but I don't think that is
> intended to be a stable public API that you should rely on. You should
> handle that kind of switch yourself if you care about compatibility across
> both versions of Python.
>
> https://github.com/kennethreitz/requests/blob/master/requests/compat.py#L86
>

Great, thank you Robert. I see that Requests is calling both urllib
and urllib2. For some reason I thought that is rather wasteful and
should be avoided. I was probably wrong!

--
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com

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


Thread

Re: Must we include urllib just to decode a URL-encoded string, when using Requests? Dotan Cohen <dotancohen@gmail.com> - 2013-06-13 16:41 +0300

csiph-web