Gestion des protocoles internet¶
Les modules documentés dans ce chapitre implémentent des protocoles relatifs à Internet et à ses technologies relatives. Ils sont tous implémentés en Python. La majorité de ces modules nécessitent la présence du module socket
lui même dépendant du système, mais fourni sur la plupart des plateformes populaires. Voici une vue d'ensemble :
webbrowser
--- Convenient web-browser controllerwsgiref
--- WSGI Utilities and Reference Implementationwsgiref.util
— outils pour les environnements WSGIwsgiref.headers
-- WSGI response header toolswsgiref.simple_server
-- a simple WSGI HTTP serverwsgiref.validate
--- WSGI conformance checkerwsgiref.handlers
-- server/gateway base classesCGIHandler
IISCGIHandler
BaseCGIHandler
SimpleHandler
BaseHandler
run()
_write()
_flush()
get_stdin()
get_stderr()
add_cgi_vars()
wsgi_multithread
wsgi_multiprocess
wsgi_run_once
os_environ
server_software
get_scheme()
setup_environ()
log_exception()
traceback_limit
error_output()
error_status
error_headers
error_body
wsgi_file_wrapper
sendfile()
origin_server
http_version
read_environ()
wsgiref.types
-- WSGI types for static type checking- Exemples
urllib
--- URL handling modulesurllib.request
--- Extensible library for opening URLsurlopen()
install_opener()
build_opener()
pathname2url()
url2pathname()
getproxies()
Request
OpenerDirector
BaseHandler
HTTPDefaultErrorHandler
HTTPRedirectHandler
HTTPCookieProcessor
ProxyHandler
HTTPPasswordMgr
HTTPPasswordMgrWithDefaultRealm
HTTPPasswordMgrWithPriorAuth
AbstractBasicAuthHandler
HTTPBasicAuthHandler
ProxyBasicAuthHandler
AbstractDigestAuthHandler
HTTPDigestAuthHandler
ProxyDigestAuthHandler
HTTPHandler
HTTPSHandler
FileHandler
DataHandler
FTPHandler
CacheFTPHandler
UnknownHandler
HTTPErrorProcessor
- Request Objects
- OpenerDirector Objects
- BaseHandler Objects
- HTTPRedirectHandler Objects
- HTTPCookieProcessor Objects
- ProxyHandler Objects
- HTTPPasswordMgr Objects
- HTTPPasswordMgrWithPriorAuth Objects
- AbstractBasicAuthHandler Objects
- HTTPBasicAuthHandler Objects
- ProxyBasicAuthHandler Objects
- AbstractDigestAuthHandler Objects
- HTTPDigestAuthHandler Objects
- ProxyDigestAuthHandler Objects
- HTTPHandler Objects
- HTTPSHandler Objects
- FileHandler Objects
- DataHandler Objects
- FTPHandler Objects
- CacheFTPHandler Objects
- UnknownHandler Objects
- HTTPErrorProcessor Objects
- Exemples
- Legacy interface
urllib.request
Restrictions
urllib.response
--- Response classes used by urlliburllib.parse
--- Parse URLs into componentsurllib.error
--- Exception classes raised by urllib.requesturllib.robotparser
--- Parser for robots.txthttp
--- HTTP moduleshttp.client
--- HTTP protocol clientHTTPConnection
HTTPSConnection
HTTPResponse
parse_headers()
HTTPException
NotConnected
InvalidURL
UnknownProtocol
UnknownTransferEncoding
UnimplementedFileMode
IncompleteRead
ImproperConnectionState
CannotSendRequest
CannotSendHeader
ResponseNotReady
BadStatusLine
LineTooLong
RemoteDisconnected
HTTP_PORT
HTTPS_PORT
responses
- Les objets HTTPConnection
- Les objets HTTPResponse
- Exemples
- Les objets HTTPMessage
ftplib
--- FTP protocol clientpoplib
--- POP3 protocol clientimaplib
--- IMAP4 protocol clientIMAP4
error
abort
readonly
IMAP4_SSL
IMAP4_stream
Internaldate2tuple()
Int2AP()
ParseFlags()
Time2Internaldate()
- IMAP4 Objects
append()
authenticate()
check()
close()
copy()
create()
delete()
deleteacl()
enable()
expunge()
fetch()
getacl()
getannotation()
getquota()
getquotaroot()
list()
login()
login_cram_md5()
logout()
lsub()
myrights()
namespace()
noop()
open()
partial()
proxyauth()
read()
readline()
recent()
rename()
response()
search()
select()
send()
setacl()
setannotation()
setquota()
shutdown()
socket()
sort()
starttls()
status()
store()
subscribe()
thread()
uid()
unsubscribe()
unselect()
xatom()
PROTOCOL_VERSION
debug
utf8_enabled
- IMAP4 Example
smtplib
--- SMTP protocol clientuuid
--- UUID objects according to RFC 4122SafeUUID
UUID
bytes
bytes_le
fields
time_low
time_mid
time_hi_version
clock_seq_hi_variant
clock_seq_low
node
time
clock_seq
hex
int
urn
variant
version
is_safe
getnode()
uuid1()
uuid3()
uuid4()
uuid5()
NAMESPACE_DNS
NAMESPACE_URL
NAMESPACE_OID
NAMESPACE_X500
RESERVED_NCS
RFC_4122
RESERVED_MICROSOFT
RESERVED_FUTURE
- Utilisation en ligne de commande.
- Exemple
- Command-Line Example
socketserver
--- A framework for network serversTCPServer
UDPServer
UnixStreamServer
UnixDatagramServer
- Notes sur la création de serveurs
- Objets serveur
BaseServer
fileno()
handle_request()
serve_forever()
service_actions()
shutdown()
server_close()
address_family
RequestHandlerClass
server_address
socket
allow_reuse_address
request_queue_size
socket_type
timeout
finish_request()
get_request()
handle_error()
handle_timeout()
process_request()
server_activate()
server_bind()
verify_request()
- Objets gestionnaire de requêtes
- Exemples
http.server
--- HTTP serversHTTPServer
ThreadingHTTPServer
BaseHTTPRequestHandler
client_address
server
close_connection
requestline
command
path
request_version
headers
rfile
wfile
server_version
sys_version
error_message_format
error_content_type
protocol_version
MessageClass
responses
handle()
handle_one_request()
handle_expect_100()
send_error()
send_response()
send_header()
send_response_only()
end_headers()
flush_headers()
log_request()
log_error()
log_message()
version_string()
date_time_string()
log_date_time_string()
address_string()
SimpleHTTPRequestHandler
CGIHTTPRequestHandler
- Considérations de sécurité
http.cookies
--- HTTP state managementhttp.cookiejar
--- Cookie handling for HTTP clientsLoadError
CookieJar
FileCookieJar
CookiePolicy
DefaultCookiePolicy
Cookie
- CookieJar and FileCookieJar Objects
- FileCookieJar subclasses and co-operation with web browsers
- CookiePolicy Objects
- DefaultCookiePolicy Objects
blocked_domains()
set_blocked_domains()
is_blocked()
allowed_domains()
set_allowed_domains()
is_not_allowed()
rfc2109_as_netscape
strict_domain
strict_rfc2965_unverifiable
strict_ns_unverifiable
strict_ns_domain
strict_ns_set_initial_dollar
strict_ns_set_path
DomainStrictNoDots
DomainStrictNonDomain
DomainRFC2965Match
DomainLiberal
DomainStrict
- Objets Cookie
- Exemples
xmlrpc
--- XMLRPC server and client modulesxmlrpc.client
--- XML-RPC client accessxmlrpc.server
--- Basic XML-RPC serversipaddress
--- IPv4/IPv6 manipulation library- Fonctions fabriques pratiques
- Adresses IP
- Définitions de réseaux IP
- Préfixe, masque réseau et masque de l'hôte
- Objets réseau
IPv4Network
version
max_prefixlen
is_multicast
is_private
is_unspecified
is_reserved
is_loopback
is_link_local
network_address
broadcast_address
hostmask
netmask
with_prefixlen
compressed
exploded
with_netmask
with_hostmask
num_addresses
prefixlen
hosts()
overlaps()
address_exclude()
subnets()
supernet()
subnet_of()
supernet_of()
compare_networks()
IPv6Network
version
max_prefixlen
is_multicast
is_private
is_unspecified
is_reserved
is_loopback
is_link_local
network_address
broadcast_address
hostmask
netmask
with_prefixlen
compressed
exploded
with_netmask
with_hostmask
num_addresses
prefixlen
hosts()
overlaps()
address_exclude()
subnets()
supernet()
subnet_of()
supernet_of()
compare_networks()
is_site_local
- Opérateurs
- Objets interface
- Autres fonctions au niveau de module
- Exceptions personnalisées