command.py 文件源码

python
阅读 64 收藏 0 点赞 0 评论 0

项目:dappled 作者: lhon 项目源码 文件源码
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'])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号