-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.py
More file actions
44 lines (33 loc) · 1.01 KB
/
script.py
File metadata and controls
44 lines (33 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import logging
import os
import sys
from edge_addons_api.client import Client, Options
from edge_addons_api.exceptions import UploadException
if len(sys.argv) < 3:
print("You must provide file_path and notes")
sys.exit(1)
file_path = sys.argv[1]
notes = sys.argv[2]
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
logging.getLogger("urllib3").setLevel(logging.WARNING)
options = Options(
product_id=os.environ["EDGE_PRODUCT_ID"],
client_id=os.environ["EDGE_CLIENT_ID"],
api_key=os.environ["EDGE_API_KEY"],
)
client = Client(options)
print("Submitting addon")
try:
resp = client.submit(file_path=file_path, notes=notes)
client.fetch_publish_status(resp)
print("Successfully uploaded addon")
except UploadException as e:
print(f"Failed to upload: {e.status} - {e.error_code} - {e.message}")
print("Errors:")
for error in e.errors:
print(f"- {error['message']}")
sys.exit(1)
except BaseException as e:
print(f"failed to upload: {e}")
sys.exit(1)