addftool 0.1.0__py3-none-any.whl → 0.1.2__py3-none-any.whl

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.
addftool/blob.py CHANGED
@@ -30,7 +30,11 @@ def create_dir_for_current_user(dir_path, sudo=False):
30
30
  if sudo:
31
31
  command = "sudo " + command
32
32
  execute_command(command)
33
- command = f"chown $USER {dir_path}"
33
+ username = os.environ.get("USER")
34
+ if username is None or username == "":
35
+ command = f"chown {os.getuid()} {dir_path}"
36
+ else:
37
+ command = f"chown $USER {dir_path}"
34
38
  if sudo:
35
39
  command = "sudo " + command
36
40
  execute_command(command)
@@ -163,22 +167,22 @@ def mount_main(args):
163
167
 
164
168
 
165
169
  def get_token(args, info=False):
166
- api_url = args.api
170
+ return get_sas_token(args.api, args.name, args.container, args.key, info=info)
171
+
167
172
 
168
- f = Fernet(args.key.encode())
173
+ # create a new function for function calling
174
+ def get_sas_token(api_url, name, container, key, info=False):
175
+ f = Fernet(key.encode())
169
176
 
170
- an = f.encrypt(args.name.encode()).decode()
171
- cn = f.encrypt(args.container.encode()).decode()
177
+ an = f.encrypt(name.encode()).decode()
178
+ cn = f.encrypt(container.encode()).decode()
172
179
 
173
180
  if info:
174
181
  print("Get token from: ", api_url)
175
182
  print("Name: ", an)
176
183
  print("Container: ", cn)
177
184
 
178
- params = {
179
- "an": an,
180
- "cn": cn,
181
- }
185
+ params = {"an": an, "cn": cn}
182
186
  response = requests.get(api_url, params=params)
183
187
  if response.status_code == 200:
184
188
  data = json.loads(response.text)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: addftool
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Requires-Dist: cryptography
5
5
  Requires-Dist: requests
6
6
  Requires-Dist: PyYAML
@@ -0,0 +1,9 @@
1
+ addftool/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ addftool/blob.py,sha256=NZOItDyFUIdV1tfhJZJJBEzGy296CE5NCictTzP4OPc,8282
3
+ addftool/tool.py,sha256=EuKQ2t2InN7yB-_oYLcdsA7vRqzRGTunwIxplUSqEG0,2054
4
+ addftool/util.py,sha256=Q3A68vJDxgfeNiEFmk54HuMuworVndocXpSbVpvGMfc,362
5
+ addftool-0.1.2.dist-info/METADATA,sha256=gmakYu_DywA1K1z3yEoLN0h43nBUFbtNy0JmKcEbTgw,126
6
+ addftool-0.1.2.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
7
+ addftool-0.1.2.dist-info/entry_points.txt,sha256=h5TlQy4AQw-J55HqI7FRkIVRUfw-x3pStFWCoYtoCTM,78
8
+ addftool-0.1.2.dist-info/top_level.txt,sha256=jqj56-plrBbyzY0tIxB6wPzjAA8kte4hUlajyyQygN4,9
9
+ addftool-0.1.2.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- addftool/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- addftool/blob.py,sha256=P4Fj6ghLsEAw3C1NpEKEe3N4_LS3EedS1OYm5C6yzPw,8006
3
- addftool/tool.py,sha256=EuKQ2t2InN7yB-_oYLcdsA7vRqzRGTunwIxplUSqEG0,2054
4
- addftool/util.py,sha256=Q3A68vJDxgfeNiEFmk54HuMuworVndocXpSbVpvGMfc,362
5
- addftool-0.1.0.dist-info/METADATA,sha256=EbzSeyvThjLaTnuLShjdJ_3skYisyb2NYaWlBv7qMd8,126
6
- addftool-0.1.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
7
- addftool-0.1.0.dist-info/entry_points.txt,sha256=h5TlQy4AQw-J55HqI7FRkIVRUfw-x3pStFWCoYtoCTM,78
8
- addftool-0.1.0.dist-info/top_level.txt,sha256=jqj56-plrBbyzY0tIxB6wPzjAA8kte4hUlajyyQygN4,9
9
- addftool-0.1.0.dist-info/RECORD,,