New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move utility functions from requests.utils to requests-toolbelt #2266

Closed
sigmavirus24 opened this Issue Oct 5, 2014 · 6 comments

Comments

Projects
None yet
3 participants
@sigmavirus24
Member

sigmavirus24 commented Oct 5, 2014

Reasoning

requests is an HTTP library, not an HTML library. Some of these utility functions are far more focused on HTML and a Response's body than on HTTP. With that said, they don't belong in requests proper. Instead they belong in a third-party library and currently the best place for that is requests-toolbelt.

Path to removal

Step 1:

  • Add DeprecationWarnings to all of these functions in the very next possible release of requests (either 2.4.3 or 2.5.0) (See PR #2309)

Step 2:

Prior to releasing 3.0, remove the following functions and migrate them to requests-toolbelt. Allow requests-toolbelt to release a version first and then release 3.0.

  • get_encodings_from_content
  • get_unicode_from_response
  • more functions?
@kennethreitz

This comment has been minimized.

Member

kennethreitz commented Oct 5, 2014

+1000000

@untitaker

This comment has been minimized.

Contributor

untitaker commented Oct 5, 2014

Why get_unicode_from_response?

@sigmavirus24

This comment has been minimized.

Member

sigmavirus24 commented Oct 6, 2014

We already provide the unicode in the response as r.text.

sigmavirus24 added a commit to sigmavirus24/requests that referenced this issue Oct 27, 2014

Add DeprecationWarnings to inform users of plans
After a long discussion in IRC and on several issues, the developers of
requests have decided to remove specific functions from requests.utils
in version 3.0.0. To give users ample time to prepare for this, we've
added DeprecationWarnings long in advance. See also the planning of this
in issue requests#2266.
@kennethreitz

This comment has been minimized.

Member

kennethreitz commented Oct 27, 2014

Back in the day, we had a function that would convert any Request object into a curl command string.

...lol

@sigmavirus24

This comment has been minimized.

Member

sigmavirus24 commented Oct 27, 2014

Yeah, people have recreated that time and again. That's not ending up in the toolbelt frankly. On the other hand, if someone wrote a function to convert it to an HTTPie command string... I might consider that ;)

ContinuousFunction added a commit to ContinuousFunction/requests that referenced this issue Nov 14, 2014

Add DeprecationWarnings to inform users of plans
After a long discussion in IRC and on several issues, the developers of
requests have decided to remove specific functions from requests.utils
in version 3.0.0. To give users ample time to prepare for this, we've
added DeprecationWarnings long in advance. See also the planning of this
in issue requests#2266.
@sigmavirus24

This comment has been minimized.

Member

sigmavirus24 commented Jul 30, 2017

I think we can close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment