Protocolos y soporte de Internet¶
Los módulos descritos en este capítulo implementan protocolos de Internet y son compatibles con la tecnología relacionada. Todos están implementados en Python. La mayoría de estos módulos requieren la presencia del módulo dependiente del sistema socket
, que actualmente es compatible con las plataformas más populares. Aquí hay una descripción general:
webbrowser
— Convenient web-browser controllerwsgiref
— WSGI Utilities and Reference Implementationwsgiref.util
– Utilidades de entorno WSGIwsgiref.headers
– Herramientas para cabeceras de respuesta WSGIwsgiref.simple_server
– Un servidor HTTP WSGI simplewsgiref.validate
— Verificador de compatibilidad WSGIwsgiref.handlers
– Clases base servidor/gatewayCGIHandler
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
— Tipos de WSGI para validadores estáticos de tipos- Ejemplos
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
- Objetos Request
- Objetos OpenerDirector
- Objetos BaseHandler
- Objetos HTTPRedirectHandler
- Objetos HTTPCookieProcessor
- Objetos ProxyHandler
- Objetos HTTPPasswordMgr
- Objetos HTTPPasswordMgrWithPriorAuth
- Objetos AbstractBasicAuthHandler
- Objetos HTTPBasicAuthHandler
- Objetos ProxyBasicAuthHandler
- Objetos AbstractDigestAuthHandler
- Objetos HTTPDigestAuthHandler
- Objetos ProxyDigestAuthHandler
- Objetos HTTPHandler
- Objetos HTTPSHandler
- Objetos FileHandler
- Objetos DataHandler
- Objetos FTPHandler
- Objetos CacheFTPHandler
- Objetos UnknownHandler
- Objetos HTTPErrorProcessor
- Ejemplos
- Interfaz heredada
- Restricciones
urllib.request
urllib.response
— Clases de respuesta usadas por 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
- Objetos de
HTTPConnection
- Objetos de
HTTPResponse
- Ejemplos
- Objetos de
HTTPMessage
ftplib
— FTP protocol clientpoplib
— POP3 protocol clientimaplib
— IMAP4 protocol clientIMAP4
error
abort
readonly
IMAP4_SSL
IMAP4_stream
Internaldate2tuple()
Int2AP()
ParseFlags()
Time2Internaldate()
- Objetos de IMAP4
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
- Ejemplo IMAP4
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
- Uso de la línea de comandos
- Ejemplo
- Ejemplo de línea de comandos
socketserver
— A framework for network serversTCPServer
UDPServer
UnixStreamServer
UnixDatagramServer
- Notas de creación del servidor
- Objetos de servidor
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()
- Solicitar objetos de controlador
- Ejemplos
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
- Consideraciones de seguridad
http.cookies
— HTTP state managementhttp.cookiejar
— Cookie handling for HTTP clientsLoadError
CookieJar
FileCookieJar
CookiePolicy
DefaultCookiePolicy
Cookie
- Objetos CookieJar y FileCookieJar
- Subclases FileCookieJar y co-operación con navegadores web
- Objetos CookiePolicy
- Objetos DefaultCookiePolicy
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
- Objetos Cookie
- Ejemplos
xmlrpc
— Módulos XMLRPC para cliente y servidorxmlrpc.client
— XML-RPC client accessxmlrpc.server
— Basic XML-RPC serversipaddress
— IPv4/IPv6 manipulation library- Funciones de fábrica de conveniencia
- Direcciones IP
- Definiciones de red IP
- Prefijo, máscara de red y máscara de host
- Objetos de red
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
- Operadores
- Objetos de interfaz
- Otras funciones de nivel de módulo
- Excepciones personalizadas