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


Groups > comp.lang.python > #47960 > unrolled thread

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

Started byRobert Kern <robert.kern@gmail.com>
First post2013-06-13 14:34 +0100
Last post2013-06-13 14:34 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  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

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

FromRobert Kern <robert.kern@gmail.com>
Date2013-06-13 14:34 +0100
SubjectRe: Must we include urllib just to decode a URL-encoded string, when using Requests?
Message-ID<mailman.3193.1371130505.3114.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web