Jump to content

Requests (software)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Certes (talk | contribs) at 17:14, 26 September 2019 (Remove advertising (via WP:JWB)). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Requests
Original author(s)Kenneth Reitz
Developer(s)Kenneth Reitz, Cory Benfield, Ian Stapleton Cordasco, Nate Prewitt
Initial releaseError: df must be either "yes" or "y" (help)
Stable release
2.22.0 / 15 May 2019; 6 years ago (2019-05-15)
Repository
Written inPython
Operating systemCross-platform[which?]
LicenseApache License 2.0
Websiterequests.readthedocs.io Edit this at Wikidata

[1]

Requests is a Python HTTP library, released under the Apache2 License. The goal of the project is to make HTTP requests simpler and more human-friendly. The current version is 2.22.0[2]

Requests is an Apache2 Licensed HTTP library, written in Python, for human beings.

Python’s standard urllib2 module provides most of the HTTP capabilities you need, but the API is thoroughly broken. It was built for a different time — and a different web. It requires an enormous amount of work (even method overrides) to perform the simplest of tasks.

Things shouldn’t be this way. Not in Python.

Example code

    >>> import requests
    >>> r = requests.get('https://api.github.com/user', auth=('user', 'pass'))
    >>> r.status_code
    200
    >>> r.headers['content-type']
    'application/json; charset=utf8'
    >>> r.encoding
    'utf-8'
    >>> r.text # doctest: +ELLIPSIS
    u'{"type":"User"...'
    >>> r.json() # doctest: +ELLIPSIS
    {u'private_gists': 419, u'total_private_repos': 77, ...}

References

  1. ^ GitHub - kennethreitz/requests: Python HTTP Requests for Humans™ ✨🍰✨., kennethreitz.org, 2019-03-25, retrieved 2019-03-25
  2. ^ Project homepage