efs-cli 1.1.0__tar.gz → 1.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: efs-cli
3
- Version: 1.1.0
3
+ Version: 1.1.1
4
4
  Summary: EepyFileServer API CLI written in Python
5
5
  Author: maxie
6
6
  License-Expression: MIT
@@ -0,0 +1,2 @@
1
+ __version__ = "1.1.1"
2
+
@@ -42,8 +42,9 @@ def init_api():
42
42
  sys.exit(1)
43
43
 
44
44
  base_url = conf.get("base_url")
45
+ custom_api_path = conf.get("custom_api_path", "/api/v1")
45
46
  password = conf.get("password", None)
46
- efs = EepyFileServerPublic(base_url, ignore_initialization = True) if password is None else EepyFileServer(base_url, password, ignore_initialization = True)
47
+ efs = EepyFileServerPublic(base_url, custom_api_path, ignore_initialization = True) if password is None else EepyFileServer(base_url, password, custom_api_path, ignore_initialization = True)
47
48
  return efs
48
49
 
49
50
  @exception_handler
@@ -51,7 +52,7 @@ def config(reset, **__):
51
52
  conf = get_conf()
52
53
  if conf is None or reset:
53
54
  with open(CONFIG_PATH, "w") as file:
54
- json.dump({"base_url": None, "password": None, "editor": "nano"}, file)
55
+ json.dump({"base_url": None, "password": None, "custom_api_path": "/api/v1", "editor": "nano"}, file)
55
56
  if reset:
56
57
  print("Config reset")
57
58
  sys.exit(0)
@@ -83,9 +84,16 @@ def efs_config(verbose, **__):
83
84
  print("Config saved successfully")
84
85
 
85
86
  @exception_handler
86
- def auth(base_url, password, **__):
87
+ def auth(base_url, password, custom_api_path, **__):
87
88
  conf = get_conf()
88
- data = {"base_url": base_url, "password": password, "editor": "nano"}
89
+ if custom_api_path is None:
90
+ custom_api_path = "/api/v1"
91
+ if custom_api_path.endswith("/"):
92
+ custom_api_path = custom_api_path[:-1]
93
+ if base_url.endswith("/"):
94
+ base_url = base_url[:-1]
95
+
96
+ data = {"base_url": base_url, "password": password, "custom_api_path": custom_api_path, "editor": "nano"}
89
97
 
90
98
  if conf is not None:
91
99
  conf.update(data)
@@ -237,6 +245,7 @@ def main():
237
245
  auth_parser = subparser.add_parser("auth", help="authorize to eepyfileserver", aliases=["login"])
238
246
  auth_parser.add_argument("base_url", help="the base url of your eepyfileserver instance")
239
247
  auth_parser.add_argument("password", nargs="?", help="password to login in your eepyfileserver instance", default=None)
248
+ auth_parser.add_argument("-c", "--custom-api-path", nargs="?", help="custom api path, default is /api/v1", default=None)
240
249
  auth_parser.set_defaults(func=auth)
241
250
 
242
251
  download_parser = subparser.add_parser("download", help="download a file", aliases=["get", "d"])
@@ -284,7 +293,7 @@ def main():
284
293
  urlfor_parser.add_argument("-c", "--check-if-exists", action="store_true", help="check if the file exists before returning the url")
285
294
  urlfor_parser.set_defaults(func=url_for)
286
295
 
287
- config_parser = subparser.add_parser("cli-config", help="view or change your cli config", aliases=["conf"])
296
+ config_parser = subparser.add_parser("cli-config", help="view or change your cli config", aliases=["conf", "config"])
288
297
  config_parser.add_argument("--reset", action="store_true", help="if set, resets your ENTIRE config")
289
298
  config_parser.set_defaults(func=config)
290
299
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: efs-cli
3
- Version: 1.1.0
3
+ Version: 1.1.1
4
4
  Summary: EepyFileServer API CLI written in Python
5
5
  Author: maxie
6
6
  License-Expression: MIT
@@ -1,2 +0,0 @@
1
- __version__ = "1.1.0"
2
-
File without changes
File without changes
File without changes
File without changes