Skip to main content

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

Project description

https://travis-ci.org/johnthagen/pytap2.svg https://codeclimate.com/github/johnthagen/pytap2/badges/gpa.svg https://codeclimate.com/github/johnthagen/pytap2/badges/issue_count.svg https://codecov.io/github/johnthagen/pytap2/coverage.svg https://img.shields.io/pypi/v/pytap2.svg https://img.shields.io/pypi/status/pytap2.svg https://img.shields.io/pypi/pyversions/pytap2.svg

Fork of PyTap that supports Python 2 & 3.

Installation

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

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

Usage

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:
    device.ifconfig(mtu=1300)
    device.write(b'0000')

Or manually call up() and close().

from pytap2 import TapDevice

device = TapDevice()
device.up()
device.ifconfig(mtu=1300)
device.write(b'0000')
device.close()

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

Releases

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.

Source Distribution

pytap2-1.3.0.tar.gz (4.1 kB view details)

Uploaded Source

File details

Details for the file pytap2-1.3.0.tar.gz.

File metadata

  • Download URL: pytap2-1.3.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pytap2-1.3.0.tar.gz
Algorithm Hash digest
SHA256 65e75ded09e21c66284ff5abb3f285728b588ba11bae468b084ee4f97d9cf2c2
MD5 ee40c3c32ea6750854aa085debfb07c6
BLAKE2b-256 36aea5a7f65fcbce67a3c2a7af0beddd10611618d0ca93cdf7e41c9966a43a7a

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page