Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

A python wrapper around oathtool

Project Description

# py_oathtool

A python wrapper script around oathtool to allow for easy OTP code generation on the command line.

This project was born out of my frustration of having many many 2-Factor accounts on my mobile phone, which did not present a quick and easy mechanism to generate and use codes.

Tested only on Mac (for now).

## Installation

pip install py_oathtool

## Dependencies

  • Python packages
    • subprocess32

oathtool should be available on the PATH

  • (Mac) brew install oath-toolkit

## Usage

List the configured accounts with the -l switch.

$ otp -l github aws-account-dev aws-account-prod

Generate an OTP by providing the account name. The script will provide the OTP code, and also drop it to the clipboard.

$ otp aws-account-dev 129987 Valid for 18 more seconds (On the clipboard!)

If a code is only valid for a short duration the script will pause until the next 30-second window begins.

$ otp cr-dev Short lived OTP. Holding off for 4 seconds… 591658 Valid for 30 more seconds (On the clipboard!)

Read about all options

$ otp -h

## Configuration

Two pieces of information are required for each account:

  • An account name / label
  • Your 64 character oath secret provided by the 3rd party. This is typically a QR code, but websites often also offer the string.

The script will read these values from a config file sourced from, by default, ~/.otp-secrets.yaml in the following format:


## Disclaimer

2-Factor is meant to provide an extra layer of account security and this tool does not exactly promote that concept. You should be responsible for taking reasonable steps to protect your secrets file, and perhaps this is not the ideal 2-Factor solution for your most important accounts.

I take no responsibility if you lose accounts through using this tool.

## Building

To follow…

pip install –user -e .

Release History

Release History

This version
History Node


History Node


Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
py_oathtool-1.0.1-py2.py3-none-any.whl (7.0 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Sep 7, 2015
py_oathtool-1.0.1.tar.gz (4.9 kB) Copy SHA256 Checksum SHA256 Source Sep 7, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting