remove GPL'd timeparse library
This commit is contained in:
parent
56b2655326
commit
8810157586
3 changed files with 14 additions and 6 deletions
|
@ -62,4 +62,3 @@ bencode
|
|||
cryptography
|
||||
httmock
|
||||
moto
|
||||
timeparse
|
||||
|
|
|
@ -107,7 +107,6 @@ SQLAlchemy==1.0.12
|
|||
stevedore==1.12.0
|
||||
stringscore==0.1.0
|
||||
stripe==1.32.0
|
||||
timeparse==0.5.5
|
||||
toposort==1.4
|
||||
trollius==2.1
|
||||
tzlocal==1.2.2
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
import argparse
|
||||
|
||||
from dateutil.parser import parse as parse_date
|
||||
|
||||
from app import app
|
||||
from data import model
|
||||
from data.database import ServiceKeyApprovalType
|
||||
from data.model.log import log_action
|
||||
from timeparse import ParseDatetime
|
||||
|
||||
import argparse
|
||||
|
||||
def generate_key(service, name, expiration_date=None, notes=None):
|
||||
metadata = {
|
||||
|
@ -34,12 +36,20 @@ def generate_key(service, name, expiration_date=None, notes=None):
|
|||
return private_key, key.kid
|
||||
|
||||
|
||||
def valid_date(s):
|
||||
try:
|
||||
return parse_date(s)
|
||||
except ValueError:
|
||||
msg = "Not a valid date: '{0}'.".format(s)
|
||||
raise argparse.ArgumentTypeError(msg)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description='Generates a preshared key')
|
||||
parser.add_argument('service', help='The service name for which the key is being generated')
|
||||
parser.add_argument('name', help='The friendly name for the key')
|
||||
parser.add_argument('--expiration', help='The optional expiration date/time for the key',
|
||||
default=None, action=ParseDatetime)
|
||||
parser.add_argument('--expiration', default=None, type=valid_date,
|
||||
help='The optional expiration date for the key')
|
||||
parser.add_argument('--notes', help='Optional notes about the key', default=None)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
|
Reference in a new issue