def handle_name_action(args):
allowed_name = r'[a-z][a-z0-9-]+$'
if args.shortname[0] not in string.ascii_lowercase:
print('"{}" does not start with an undercase letter'.format(args.shortname))
sys.exit()
if not re.match(allowed_name, args.shortname):
print('"{}" must consist only of undercase letters, numbers, and dashes'.format(args.shortname))
sys.exit()
options = dict(
username=raw_input('Username: '),
password=getpass(),
id=args.id,
shortname=args.shortname,
)
r = requests.post(HOST+'/api/name', data=options)
rj = r.json()
print(rj['message'])
评论列表
文章目录