Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Object-oriented wrapper around the Linux Tun/Tap device for Python 2 and 3

Project description

Fork of PyTap that supports Python 2 & 3.


You can install, upgrade, and uninstall pytap2 with these commands:

$ pip install pytap2
$ pip install --upgrade pytap2
$ pip uninstall pytap2


Using as a context manager automatically brings up the device and closes it at the end of the with block.

from pytap2 import TapDevice

with TapDevice() as device:

Or manually call up() and close().

from pytap2 import TapDevice

device = TapDevice()

The fileno() method is defined, so that the device object can be passed directly to select().


1.5.0 - 2018-07-09

Support Python 3.7.

1.4.0 - 2017-10-24

Allow disabling packet information header (IFF_NO_PI) and default read() to read entire MTU worth of data plus the packet information header if present.

1.3.0 - 2017-07-31

Add fileno() method to support select() calls.

1.2.0 - 2017-06-19

Context manager support added.

1.1.0 - 2017-06-17

Allow read() to be called with a specific number of bytes to read.

1.0.0 - 2017-06-16

Initial release that supports Python 2 and 3.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pytap2, version 1.5.0
Filename, size File type Python version Upload date Hashes
Filename, size pytap2-1.5.0.tar.gz (4.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page