Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.2 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Libraries

    requests 1.1.0

    Download button

    No screenshots available
    Downloads: 574  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Kenneth Reitz | More programs
    ISC License / FREE
    August 29th, 2012, 08:47 GMT [view history]
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    requests description

    Python HTTP Library that's actually usable

    requests are the most existing Python modules for dealing HTTP requests are insane.

    Developer comments

    I have to look up everything that I want to do. Most of my worst Python experiences are a result of the various built-in HTTP libraries (yes, even worse than Logging).

    But this one's different. This one's going to be awesome. And simple.

    Usage:

    It couldn't be simpler.

    >>> import requests
    >>> r = requests.get('http://google.com')


    HTTPS? Basic Authentication?

    >>> r = requests.get('https://convore.com/api/account/verify.json')
    >>> r.status_code
    401


    Uh oh, we're not authorized! Let's add authentication.

    >>> conv_auth = requests.AuthObject('requeststest', 'requeststest')
    >>> r = requests.get('https://convore.com/api/account/verify.json', auth=conv_auth)

    >>> r.status_code
    200


    >>> r.headers['content-type']
    'application/json'


    >>> r.content
    '{"username": "requeststest", "url": "/users/requeststest/", "id": "9408", "img": "censored-long-url"}'


    API

    Requests:

    All request functions return a Response object (see below).

     GET Requests

     >>> request.get(url, params={}, headers={} auth=None)
     < request object >


     HEAD Requests

     >>> request.head(url, params={}, headers={} auth=None)
     < request object >


     PUT Requests

     >>> request.put(url, data='', headers={}, auth=None)
     < request object >


     POST Requests

     >>> request.post(url, data={}, headers={}, auth=None)
     < request object >


     DELETE Requests

     >>> request.delete(url, params={}, headers={}, auth=None)
     < request object >


    Responses:

     Request.status_code:
     (Integer) Received HTTP Status Code Response
     Request.headers:
     (Dictionary) Received HTTP Response Headers
     Request.content:
     (Bytes) Received Content

    HTTP Authentication Registry:

     You can register AuthObjects to automatically enable HTTP Authentication on requests that contain a registered base URL string.

     >>> requests.add_autoauth(url, authobject)

    Installation:


    To install requests, simply:

    pip install requests

    Or, if you absolutely must:

    easy_install requests

    But, you really shouldn't do that.


    Product's homepage

    Here are some key features of "requests":

    Extremely simple GET, HEAD, POST, PUT, DELETE Requests:

    · Simple HTTP Header Request Attachment
    · Simple Data/Params Request Attachment

    Simple Basic HTTP Authentication:

    · Simple URL + HTTP Auth Registry

    Requirements:

    · Python

    What's New in This Release: [ read full changelog ]

    · CHUNKED REQUESTS
    · Support for iterable response bodies
    · Assume servers persist redirect params
    · Allow explicit content types to be specified for file data
    · Make merge_kwargs case-insensitive when looking up keys

      


    TAGS:

    HTTP library | Python library | HTTP requests | Python | HTTP | library

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM