Developpez.com

Python

Choisissez la catégorie, puis la rubrique :

18.6.1 Request Objects


18.6.1 Request Objects

The following methods describe all of Request's public interface, and so all must be overridden in subclasses.

add_data( data)
Set the Request data to data. This is ignored by all handlers except HTTP handlers -- and there it should be a byte string, and will change the request to be POST rather than GET.

get_method( )
Return a string indicating the HTTP request method. This is only meaningful for HTTP requests, and currently always returns 'GET' or 'POST'.

has_data( )
Return whether the instance has a non-None data.

get_data( )
Return the instance's data.

add_header( key, val)
Add another header to the request. Headers are currently ignored by all handlers except HTTP handlers, where they are added to the list of headers sent to the server. Note that there cannot be more than one header with the same name, and later calls will overwrite previous calls in case the key collides. Currently, this is no loss of HTTP functionality, since all headers which have meaning when used more than once have a (header-specific) way of gaining the same functionality using only one header.

add_unredirected_header( key, header)
Add a header that will not be added to a redirected request. New in version 2.4.

has_header( header)
Return whether the instance has the named header (checks both regular and unredirected). New in version 2.4.

get_full_url( )
Return the URL given in the constructor.

get_type( )
Return the type of the URL -- also known as the scheme.

get_host( )
Return the host to which a connection will be made.

get_selector( )
Return the selector -- the part of the URL that is sent to the server.

set_proxy( host, type)
Prepare the request by connecting to a proxy server. The host and type will replace those of the instance, and the instance's selector will be the original URL given in the constructor.

get_origin_req_host( )
Return the request-host of the origin transaction, as defined by RFC 2965. See the documentation for the Request constructor.

is_unverifiable( )
Return whether the request is unverifiable, as defined by RFC 2965. See the documentation for the Request constructor.

See About this document... for information on suggesting changes.
Sondage : quels sont les langages de programmation que vous détestez le plus en 2019 ? Pourquoi ?
Quels sont les langages de programmation que vous voulez apprendre en 2019 ?
Quels sont vos environnements de développement intégrés (EDI) préférés en 2018 ? Et pourquoi ?
Découvrir et apprendre les possibilités de Python pour le calcul scientifique, un tutoriel de Lejocelyn
Contacter le responsable de la rubrique Python

Partenaire : Hébergement Web