uncloud-cli/commands/order.py

24 lines
599 B
Python
Raw Normal View History

2019-09-14 17:15:56 +00:00
import click
import requests
from decouple import config
from .helper import OTPCredentials, load_dump_pretty
@click.group()
def order():
pass
@order.command("list")
@click.option("--name", envvar="OTP_NAME", required=True)
@click.option("--realm", envvar="OTP_REALM", required=True)
@click.option("--seed", envvar="OTP_SEED", required=True)
2019-09-19 10:19:09 +00:00
def list(name, realm, seed):
2019-09-14 17:15:56 +00:00
data = {
2019-09-19 10:19:09 +00:00
**OTPCredentials(name, realm, seed).get_json()
2019-09-14 17:15:56 +00:00
}
r = requests.get("{}/order/list".format(config('UCLOUD_PAY_SERVER')),
json=data)
print(load_dump_pretty(r.content))