xeno-crufto script stub
parent
19e720abc7
commit
8b72fb9fe4
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import requests
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"-a",
|
||||
"--api",
|
||||
help="API URL",
|
||||
type=str,
|
||||
required=False,
|
||||
default="https://xeno-canto.org/api/2/recordings",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
API_URL = args.api
|
||||
|
||||
def print_json(jsn):
|
||||
print(json.dumps(json.loads(jsn), sort_keys=True, indent=4))
|
||||
|
||||
resp = requests.post(
|
||||
f"{API_URL}",
|
||||
)
|
||||
|
||||
print_json(resp.text)
|
||||
print(resp.status_code)
|
||||
|
Loading…
Reference in New Issue