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


Groups > comp.lang.python > #47960

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!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'python.': 0.02; 'that?': 0.05; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'so?': 0.09; 'subject:string': 0.09; 'subject:using': 0.09; 'url:github': 0.09; 'api': 0.11; 'python': 0.11; 'kern': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject: \n ': 0.16; 'subject:URL': 0.16; 'subject:when': 0.16; 'underlying': 0.16; 'urllib': 0.16; 'urllib2,': 0.16; 'using,': 0.16; 'wrote:': 0.18; 'library': 0.18; 'thu,': 0.19; 'import': 0.22; 'header:User- Agent:1': 0.23; 'interpret': 0.24; 'issue,': 0.24; 'server.': 0.24; 'versions': 0.24; 'switch': 0.26; 'gets': 0.27; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'robert': 0.30; "i'm": 0.30; 'requests': 0.31; '13,': 0.31; 'yes.': 0.31; 'problem': 0.35; 'skip:u 20': 0.35; 'something': 0.35; 'no,': 0.35; 'but': 0.35; 'there': 0.35; 'doing': 0.36; 'subject:?': 0.36; 'should': 0.36; 'stable': 0.38; 'handle': 0.38; 'whatever': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'rather': 0.38; 'does': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'received:org': 0.40; 'skip:u 10': 0.60; 'tell': 0.60; 'issues,': 0.61; 'kind': 0.63; 'our': 0.64; 'talking': 0.65; 'world': 0.66; 'between': 0.67; 'believe': 0.68; 'other.': 0.75; 'yourself': 0.78; 'eco': 0.84; 'subject:Must': 0.84; 'terrible': 0.84; 'url:master': 0.84; '2013': 0.98
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Robert Kern <robert.kern@gmail.com>
Subject Re: Must we include urllib just to decode a URL-encoded string, when using Requests?
Date Thu, 13 Jun 2013 14:34:46 +0100
References <CAKDXFkO6t9dkYTrughGL4DzBfAOypia7w34hkmFAN9xext9TWA@mail.gmail.com> <kpcgvj$m7p$1@ger.gmane.org> <CAKDXFkOYUgb-Sw=MK3SpSNPUAO+ubt248E9KX39aK8T7+=ZcUQ@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host 213.1.240.226
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130509 Thunderbird/17.0.6
In-Reply-To <CAKDXFkOYUgb-Sw=MK3SpSNPUAO+ubt248E9KX39aK8T7+=ZcUQ@mail.gmail.com>
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.3193.1371130505.3114.python-list@python.org> (permalink)
Lines 31
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1371130505 news.xs4all.nl 16012 [2001:888:2000:d::a6]:46507
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:47960

Show key headers only | View raw


On 2013-06-13 14:25, Dotan Cohen wrote:
> On Thu, Jun 13, 2013 at 4:20 PM, Robert Kern <robert.kern@gmail.com> wrote:
>> Yes. Do you think there is a problem with doing so?
>
> 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 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

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

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? Robert Kern <robert.kern@gmail.com> - 2013-06-13 14:34 +0100

csiph-web