This section of the document groups gevent APIs by functional area. For an alphabetical listing by module, see Module Listing.
gevent
– common functions
gevent.Timeout
GreenletExit
Greenlet
Greenlet.__init__()
Greenlet.exception
Greenlet.minimal_ident
Greenlet.name
Greenlet.dead
Greenlet.value
Greenlet.spawn_tree_locals
Greenlet.spawning_greenlet
Greenlet.spawning_stack
Greenlet.spawning_stack_limit
Greenlet.spawn()
Greenlet.ready()
Greenlet.successful()
Greenlet.start()
Greenlet.start_later()
Greenlet.join()
Greenlet.get()
Greenlet.kill()
Greenlet.link()
Greenlet.link_value()
Greenlet.link_exception()
Greenlet.rawlink()
Greenlet.unlink()
Greenlet.__str__()
Greenlet.add_spawn_callback()
Greenlet.remove_spawn_callback()
gevent.socket
– Cooperative low-level networking interfacegethostbyname()
socket
SocketType
socket
socket.accept()
socket.bind()
socket.connect()
socket.connect_ex()
socket.detach()
socket.dup()
socket.fileno()
socket.get_inheritable()
socket.getblocking()
socket.getpeername()
socket.getsockname()
socket.getsockopt()
socket.gettimeout()
socket.listen()
socket.makefile()
socket.recv()
socket.recv_into()
socket.recvfrom()
socket.recvfrom_into()
socket.send()
socket.sendall()
socket.sendfile()
socket.sendto()
socket.set_inheritable()
socket.setblocking()
socket.setsockopt()
socket.settimeout()
socket.shutdown()
socket.family
socket.proto
socket.type
create_connection()
fromfd()
getaddrinfo()
getfqdn()
gethostbyaddr()
gethostbyname()
gethostbyname_ex()
getnameinfo()
socketpair()
error
gaierror
herror
timeout
SocketType
socket
socket.bind()
socket.connect()
socket.connect_ex()
socket.dup()
socket.fileno()
socket.getblocking()
socket.getpeername()
socket.getsockname()
socket.getsockopt()
socket.gettimeout()
socket.listen()
socket.recv()
socket.recv_into()
socket.recvfrom()
socket.recvfrom_into()
socket.send()
socket.sendall()
socket.sendto()
socket.setblocking()
socket.setsockopt()
socket.settimeout()
socket.shutdown()
socket.family
socket.proto
socket.type
create_server()
getaddrinfo()
getdefaulttimeout()
getfqdn()
gethostbyaddr()
gethostbyname()
gethostbyname_ex()
gethostname()
getnameinfo()
getprotobyname()
getservbyname()
getservbyport()
has_dualstack_ipv6()
htonl()
htons()
inet_aton()
inet_ntoa()
inet_ntop()
inet_pton()
ntohl()
ntohs()
recv_fds()
send_fds()
setdefaulttimeout()
sethostname()
gevent.ssl
– Secure Sockets Layer (SSL/TLS) moduleSSLObject
CertificateError
SSLCertVerificationError
SSLEOFError
SSLError
SSLSyscallError
SSLWantReadError
SSLWantWriteError
SSLZeroReturnError
socket_error
AlertDescription
DefaultVerifyPaths
Options
Purpose
SSLContext
SSLErrorNumber
SSLObject
SSLObject.cipher()
SSLObject.compression()
SSLObject.do_handshake()
SSLObject.get_channel_binding()
SSLObject.getpeercert()
SSLObject.pending()
SSLObject.read()
SSLObject.selected_alpn_protocol()
SSLObject.selected_npn_protocol()
SSLObject.shared_ciphers()
SSLObject.unwrap()
SSLObject.version()
SSLObject.write()
SSLObject.context
SSLObject.server_hostname
SSLObject.server_side
SSLObject.session
SSLObject.session_reused
SSLSocket
SSLSocket.accept()
SSLSocket.connect()
SSLSocket.connect_ex()
SSLSocket.do_handshake()
SSLSocket.dup()
SSLSocket.get_channel_binding()
SSLSocket.getpeercert()
SSLSocket.read()
SSLSocket.recv()
SSLSocket.recv_into()
SSLSocket.recvfrom()
SSLSocket.recvfrom_into()
SSLSocket.send()
SSLSocket.sendall()
SSLSocket.sendto()
SSLSocket.shared_ciphers()
SSLSocket.shutdown()
SSLSocket.version()
SSLSocket.write()
SSLSocket.session
SSLSocket.session_reused
TLSVersion
VerifyFlags
VerifyMode
DER_cert_to_PEM_cert()
PEM_cert_to_DER_cert()
RAND_add()
RAND_bytes()
RAND_pseudo_bytes()
RAND_status()
cert_time_to_seconds()
create_connection()
create_default_context()
get_default_verify_paths()
get_server_certificate()
match_hostname()
CertificateError
SSLCertVerificationError
SSLEOFError
SSLError
SSLSyscallError
SSLWantReadError
SSLWantWriteError
SSLZeroReturnError
socket_error
AlertDescription
DefaultVerifyPaths
Options
Purpose
SSLContext
SSLErrorNumber
SSLObject
SSLObject.cipher()
SSLObject.compression()
SSLObject.do_handshake()
SSLObject.get_channel_binding()
SSLObject.getpeercert()
SSLObject.pending()
SSLObject.read()
SSLObject.selected_alpn_protocol()
SSLObject.selected_npn_protocol()
SSLObject.shared_ciphers()
SSLObject.unwrap()
SSLObject.version()
SSLObject.write()
SSLObject.context
SSLObject.server_hostname
SSLObject.server_side
SSLObject.session
SSLObject.session_reused
SSLSocket
SSLSocket.accept()
SSLSocket.connect()
SSLSocket.connect_ex()
SSLSocket.do_handshake()
SSLSocket.dup()
SSLSocket.get_channel_binding()
SSLSocket.getpeercert()
SSLSocket.makefile()
SSLSocket.read()
SSLSocket.recv()
SSLSocket.recv_into()
SSLSocket.recvfrom()
SSLSocket.recvfrom_into()
SSLSocket.send()
SSLSocket.sendall()
SSLSocket.sendto()
SSLSocket.shutdown()
SSLSocket.version()
SSLSocket.write()
TLSVersion
VerifyFlags
VerifyMode
DER_cert_to_PEM_cert()
PEM_cert_to_DER_cert()
RAND_add()
RAND_bytes()
RAND_pseudo_bytes()
RAND_status()
cert_time_to_seconds()
create_default_context()
get_default_verify_paths()
get_server_certificate()
match_hostname()
CertificateError
SSLCertVerificationError
SSLEOFError
SSLError
SSLSyscallError
SSLWantReadError
SSLWantWriteError
SSLZeroReturnError
socket_error
AlertDescription
DefaultVerifyPaths
Options
Purpose
SSLContext
SSLErrorNumber
SSLObject
SSLObject.cipher()
SSLObject.compression()
SSLObject.do_handshake()
SSLObject.get_channel_binding()
SSLObject.getpeercert()
SSLObject.pending()
SSLObject.read()
SSLObject.selected_alpn_protocol()
SSLObject.selected_npn_protocol()
SSLObject.shared_ciphers()
SSLObject.unwrap()
SSLObject.version()
SSLObject.write()
SSLObject.context
SSLObject.server_hostname
SSLObject.server_side
SSLObject.session
SSLObject.session_reused
SSLSocket
SSLSocket.accept()
SSLSocket.connect()
SSLSocket.do_handshake()
SSLSocket.getpeercert()
SSLSocket.makefile()
SSLSocket.read()
SSLSocket.recv()
SSLSocket.recv_into()
SSLSocket.recvfrom()
SSLSocket.recvfrom_into()
SSLSocket.send()
SSLSocket.sendall()
SSLSocket.sendto()
SSLSocket.shutdown()
SSLSocket.write()
TLSVersion
VerifyFlags
VerifyMode
DER_cert_to_PEM_cert()
PEM_cert_to_DER_cert()
RAND_add()
RAND_bytes()
RAND_pseudo_bytes()
RAND_status()
cert_time_to_seconds()
create_connection()
create_default_context()
get_default_verify_paths()
get_server_certificate()
match_hostname()
sslwrap_simple()
wrap_socket()
gevent.select
– Waiting for I/O completion
gevent.selectors
– High-level IO Multiplexing
gevent.event
– Notifications of multiple listenersEvent
AsyncResult
AsyncResult.cancel()
AsyncResult.cancelled()
AsyncResult.done()
AsyncResult.get()
AsyncResult.get_nowait()
AsyncResult.ready()
AsyncResult.result()
AsyncResult.set()
AsyncResult.set_exception()
AsyncResult.set_result()
AsyncResult.successful()
AsyncResult.wait()
AsyncResult.exc_info
AsyncResult.exception
AsyncResult.value
gevent.queue
– Synchronized queues
gevent.local
– Greenlet-local objects
gevent.lock
– Locking primitives
gevent.hub
- The Event Loop and the Hubget_hub()
Hub
ILoop
ILoop.default
ILoop.approx_timer_resolution
ILoop.run()
ILoop.now()
ILoop.update_now()
ILoop.destroy()
ILoop.io()
ILoop.closing_fd()
ILoop.timer()
ILoop.signal()
ILoop.idle()
ILoop.prepare()
ILoop.check()
ILoop.fork()
ILoop.async_()
ILoop.child()
ILoop.stat()
ILoop.run_callback()
ILoop.run_callback_threadsafe()
IWatcher
ICallback
gevent.core
- (deprecated) event loop abstractionThis section of the document groups gevent APIs by module.
gevent
– common functions
gevent.backdoor
– Interactive greenlet-based network console that can be used in any process
gevent.baseserver
– Base class for implementing servers
gevent.builtins
– gevent friendly implementations of builtin functionsgevent.contextvars
– Cooperative contextvars
gevent.core
- (deprecated) event loop abstractiongevent.event
– Notifications of multiple listenersEvent
AsyncResult
AsyncResult.cancel()
AsyncResult.cancelled()
AsyncResult.done()
AsyncResult.get()
AsyncResult.get_nowait()
AsyncResult.ready()
AsyncResult.result()
AsyncResult.set()
AsyncResult.set_exception()
AsyncResult.set_result()
AsyncResult.successful()
AsyncResult.wait()
AsyncResult.exc_info
AsyncResult.exception
AsyncResult.value
gevent.events
– Publish/subscribe event infrastructureDoNotPatch
IEventLoopBlocked
IGeventDidPatchAllEvent
IGeventDidPatchBuiltinModulesEvent
IGeventDidPatchEvent
IGeventDidPatchModuleEvent
IGeventPatchEvent
IGeventWillPatchAllEvent
IGeventWillPatchEvent
IGeventWillPatchModuleEvent
IMemoryUsageThresholdExceeded
IMemoryUsageUnderThreshold
IPeriodicMonitorThread
IPeriodicMonitorThreadStartedEvent
EventLoopBlocked
GeventDidPatchAllEvent
GeventDidPatchBuiltinModulesEvent
GeventDidPatchModuleEvent
GeventPatchEvent
GeventWillPatchAllEvent
GeventWillPatchEvent
GeventWillPatchModuleEvent
MemoryUsageThresholdExceeded
MemoryUsageUnderThreshold
PeriodicMonitorThreadStartedEvent
subscribers
gevent.exceptions
– Exceptions
gevent.fileobject
– Wrappers to make file-like objects cooperative
gevent.hub
- The Event Loop and the Hubget_hub()
Hub
ILoop
ILoop.default
ILoop.approx_timer_resolution
ILoop.run()
ILoop.now()
ILoop.update_now()
ILoop.destroy()
ILoop.io()
ILoop.closing_fd()
ILoop.timer()
ILoop.signal()
ILoop.idle()
ILoop.prepare()
ILoop.check()
ILoop.fork()
ILoop.async_()
ILoop.child()
ILoop.stat()
ILoop.run_callback()
ILoop.run_callback_threadsafe()
IWatcher
ICallback
gevent.local
– Greenlet-local objects
gevent.lock
– Locking primitives
gevent.monkey
– Make the standard library cooperativeget_original()
is_module_patched()
is_object_patched()
main()
patch_all()
patch_builtins()
patch_dns()
patch_module()
patch_os()
patch_queue()
patch_select()
patch_signal()
patch_socket()
patch_ssl()
patch_subprocess()
patch_sys()
patch_thread()
patch_time()
gevent.os
– Low-level operating system functions from os
gevent.pool
– Managing greenlets in a groupGroup
Group.greenlet_class
Group.__len__()
Group.__contains__()
Group.greenlet_class
Group.add()
Group.apply()
Group.apply_async()
Group.apply_cb()
Group.discard()
Group.full()
Group.imap()
Group.imap_unordered()
Group.join()
Group.kill()
Group.killone()
Group.map()
Group.map_async()
Group.spawn()
Group.start()
Group.wait_available()
PoolFull
Pool
gevent.pywsgi
– A pure-Python, gevent-friendly WSGI server
gevent.queue
– Synchronized queues
gevent.resolver.ares
– c-ares based hostname resolver
gevent.resolver.blocking
– Non-cooperative resolver
gevent.resolver.dnspython
– Pure Python hostname resolvergevent.resolver.thread
– thread based hostname resolver
gevent.select
– Waiting for I/O completion
gevent.server
– TCP/SSL server
gevent.signal
– Cooperative implementation of special cases of signal.signal()
gevent.socket
– Cooperative low-level networking interfacegethostbyname()
socket
SocketType
socket
socket.accept()
socket.bind()
socket.connect()
socket.connect_ex()
socket.detach()
socket.dup()
socket.fileno()
socket.get_inheritable()
socket.getblocking()
socket.getpeername()
socket.getsockname()
socket.getsockopt()
socket.gettimeout()
socket.listen()
socket.makefile()
socket.recv()
socket.recv_into()
socket.recvfrom()
socket.recvfrom_into()
socket.send()
socket.sendall()
socket.sendfile()
socket.sendto()
socket.set_inheritable()
socket.setblocking()
socket.setsockopt()
socket.settimeout()
socket.shutdown()
socket.family
socket.proto
socket.type
create_connection()
fromfd()
getaddrinfo()
getfqdn()
gethostbyaddr()
gethostbyname()
gethostbyname_ex()
getnameinfo()
socketpair()
error
gaierror
herror
timeout
SocketType
socket
socket.bind()
socket.connect()
socket.connect_ex()
socket.dup()
socket.fileno()
socket.getblocking()
socket.getpeername()
socket.getsockname()
socket.getsockopt()
socket.gettimeout()
socket.listen()
socket.recv()
socket.recv_into()
socket.recvfrom()
socket.recvfrom_into()
socket.send()
socket.sendall()
socket.sendto()
socket.setblocking()
socket.setsockopt()
socket.settimeout()
socket.shutdown()
socket.family
socket.proto
socket.type
create_server()
getaddrinfo()
getdefaulttimeout()
getfqdn()
gethostbyaddr()
gethostbyname()
gethostbyname_ex()
gethostname()
getnameinfo()
getprotobyname()
getservbyname()
getservbyport()
has_dualstack_ipv6()
htonl()
htons()
inet_aton()
inet_ntoa()
inet_ntop()
inet_pton()
ntohl()
ntohs()
recv_fds()
send_fds()
setdefaulttimeout()
sethostname()
gevent.ssl
– Secure Sockets Layer (SSL/TLS) moduleSSLObject
CertificateError
SSLCertVerificationError
SSLEOFError
SSLError
SSLSyscallError
SSLWantReadError
SSLWantWriteError
SSLZeroReturnError
socket_error
AlertDescription
DefaultVerifyPaths
Options
Purpose
SSLContext
SSLErrorNumber
SSLObject
SSLObject.cipher()
SSLObject.compression()
SSLObject.do_handshake()
SSLObject.get_channel_binding()
SSLObject.getpeercert()
SSLObject.pending()
SSLObject.read()
SSLObject.selected_alpn_protocol()
SSLObject.selected_npn_protocol()
SSLObject.shared_ciphers()
SSLObject.unwrap()
SSLObject.version()
SSLObject.write()
SSLObject.context
SSLObject.server_hostname
SSLObject.server_side
SSLObject.session
SSLObject.session_reused
SSLSocket
SSLSocket.accept()
SSLSocket.connect()
SSLSocket.connect_ex()
SSLSocket.do_handshake()
SSLSocket.dup()
SSLSocket.get_channel_binding()
SSLSocket.getpeercert()
SSLSocket.read()
SSLSocket.recv()
SSLSocket.recv_into()
SSLSocket.recvfrom()
SSLSocket.recvfrom_into()
SSLSocket.send()
SSLSocket.sendall()
SSLSocket.sendto()
SSLSocket.shared_ciphers()
SSLSocket.shutdown()
SSLSocket.version()
SSLSocket.write()
SSLSocket.session
SSLSocket.session_reused
TLSVersion
VerifyFlags
VerifyMode
DER_cert_to_PEM_cert()
PEM_cert_to_DER_cert()
RAND_add()
RAND_bytes()
RAND_pseudo_bytes()
RAND_status()
cert_time_to_seconds()
create_connection()
create_default_context()
get_default_verify_paths()
get_server_certificate()
match_hostname()
CertificateError
SSLCertVerificationError
SSLEOFError
SSLError
SSLSyscallError
SSLWantReadError
SSLWantWriteError
SSLZeroReturnError
socket_error
AlertDescription
DefaultVerifyPaths
Options
Purpose
SSLContext
SSLErrorNumber
SSLObject
SSLObject.cipher()
SSLObject.compression()
SSLObject.do_handshake()
SSLObject.get_channel_binding()
SSLObject.getpeercert()
SSLObject.pending()
SSLObject.read()
SSLObject.selected_alpn_protocol()
SSLObject.selected_npn_protocol()
SSLObject.shared_ciphers()
SSLObject.unwrap()
SSLObject.version()
SSLObject.write()
SSLObject.context
SSLObject.server_hostname
SSLObject.server_side
SSLObject.session
SSLObject.session_reused
SSLSocket
SSLSocket.accept()
SSLSocket.connect()
SSLSocket.connect_ex()
SSLSocket.do_handshake()
SSLSocket.dup()
SSLSocket.get_channel_binding()
SSLSocket.getpeercert()
SSLSocket.makefile()
SSLSocket.read()
SSLSocket.recv()
SSLSocket.recv_into()
SSLSocket.recvfrom()
SSLSocket.recvfrom_into()
SSLSocket.send()
SSLSocket.sendall()
SSLSocket.sendto()
SSLSocket.shutdown()
SSLSocket.version()
SSLSocket.write()
TLSVersion
VerifyFlags
VerifyMode
DER_cert_to_PEM_cert()
PEM_cert_to_DER_cert()
RAND_add()
RAND_bytes()
RAND_pseudo_bytes()
RAND_status()
cert_time_to_seconds()
create_default_context()
get_default_verify_paths()
get_server_certificate()
match_hostname()
CertificateError
SSLCertVerificationError
SSLEOFError
SSLError
SSLSyscallError
SSLWantReadError
SSLWantWriteError
SSLZeroReturnError
socket_error
AlertDescription
DefaultVerifyPaths
Options
Purpose
SSLContext
SSLErrorNumber
SSLObject
SSLObject.cipher()
SSLObject.compression()
SSLObject.do_handshake()
SSLObject.get_channel_binding()
SSLObject.getpeercert()
SSLObject.pending()
SSLObject.read()
SSLObject.selected_alpn_protocol()
SSLObject.selected_npn_protocol()
SSLObject.shared_ciphers()
SSLObject.unwrap()
SSLObject.version()
SSLObject.write()
SSLObject.context
SSLObject.server_hostname
SSLObject.server_side
SSLObject.session
SSLObject.session_reused
SSLSocket
SSLSocket.accept()
SSLSocket.connect()
SSLSocket.do_handshake()
SSLSocket.getpeercert()
SSLSocket.makefile()
SSLSocket.read()
SSLSocket.recv()
SSLSocket.recv_into()
SSLSocket.recvfrom()
SSLSocket.recvfrom_into()
SSLSocket.send()
SSLSocket.sendall()
SSLSocket.sendto()
SSLSocket.shutdown()
SSLSocket.write()
TLSVersion
VerifyFlags
VerifyMode
DER_cert_to_PEM_cert()
PEM_cert_to_DER_cert()
RAND_add()
RAND_bytes()
RAND_pseudo_bytes()
RAND_status()
cert_time_to_seconds()
create_connection()
create_default_context()
get_default_verify_paths()
get_server_certificate()
match_hostname()
sslwrap_simple()
wrap_socket()
gevent.subprocess
– Cooperative subprocess
module
gevent.thread
– Implementation of the standard thread
module that spawns greenlets
gevent.threading
– Implementation of the standard threading
using greenlets
gevent.threadpool
- A pool of native threads
gevent.time
– Makes sleep gevent aware
gevent.util
– Low-level utilities
These modules are deprecated and should not be used in new code.
Next page: Cooperative Timeouts Using gevent.Timeout