This module provides a mechanism to execute a function when a specific event on a file handle, file descriptor, or signal occurs, or after a given time has passed. It also provides wrappers around structures and functions from libevent-dns and libevent-http.
This module does not work with the greenlets. A callback passed to a method from this module will be executed in the event loop, which is running in the Hub greenlet. Therefore it must not use any synchronous gevent API, that is, the functions that switch to the Hub. It’s OK to call asynchronous stuff like gevent.spawn(), Event.set <gevent.event.Event.set() or Queue.put_nowait.
The code is based on pyevent.
Create a new event object with a user callback.
Add event to be executed after an optional timeout - number of seconds after which the event will be executed.
Remove event from the event queue.
Return True if the event is still scheduled to run.
Create a new scheduled event with evtype=EV_READ
Create a new scheduled event with evtype=EV_WRITE
Create a new scheduled timer
Create a new persistent signal event
Initialize event queue.
Dispatch all events on the event queue. Returns 0 on success, and 1 if no events are registered. May raise IOError.
Dispatch all pending events on queue in a single pass. Returns 0 on success, and 1 if no events are registered. May raise IOError.
Wrapper for event_get_version()
Wrapper for event_get_method()
Return _EVENT_VERSION
Initialize async DNS resolver.
Shutdown the async DNS resolver and terminate all active requests.
Lookup an A record for a given name.
Lookup an AAAA record for a given name.
Lookup a PTR record for a given IPv4 address.
Lookup a PTR record for a given IPv6 address.
file-like wrapper for libevent’s evbuffer structure.
Note, that the wrapper does not own the structure, libevent does.
x.next() -> the next value, or raise StopIteration
Drain the first size bytes from the buffer (or what’s left if there are less than size bytes).
If size is negative, drain the whole buffer.
Wrapper around libevent’s evhttp_request structure.