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?branch=master 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 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

2.0.0 - 2020-03-29

  • Drop Python 2.7.

1.6.0 - 2019-12-15

  • Drop Python 3.4 and support Python 3.8.

  • Include license file.

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.

Source Distribution

pytap2-2.0.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

pytap2-2.0.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytap2-2.0.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5

File hashes

Hashes for pytap2-2.0.0.tar.gz
Algorithm Hash digest
SHA256 cf084ea493991bff25eafc2a4229f6246a529a1622eb7bab7938b48ffe245726
MD5 f0e1bcac36ddf284f38a3e533224a113
BLAKE2b-256 203f8ae523f7003233b81b1d0f29b4ed962b212fef7f0cc50a65c0498cf5de21

See more details on using hashes here.

Provenance

File details

Details for the file pytap2-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: pytap2-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5

File hashes

Hashes for pytap2-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e0b0cccb8f9c7040f15c3319834375c5e038dc91ee9b835bf2f167ebe263a6c2
MD5 9904084de88980a4c0f6b0b72e603338
BLAKE2b-256 b342e00caa7c20268b460ca1826ad14c650a35770eac624ff3e2b3f3e1bddf8b

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