isrpa 0.9.3__py3-none-any.whl → 0.9.5__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.
isrpa/credentials.py CHANGED
@@ -1,8 +1,10 @@
1
1
  import os
2
2
 
3
3
  import requests
4
+ from dotenv import load_dotenv
4
5
 
5
-
6
+ load_dotenv("/isearch/.env", override=True)
7
+ address = os.getenv("address")
6
8
  def store_key(key_name,key_value,user_name):
7
9
  """
8
10
  用户凭证存储
@@ -11,9 +13,9 @@ def store_key(key_name,key_value,user_name):
11
13
  user_name:用户名
12
14
 
13
15
  """
14
- address = os.environ.get("address", "192.168.12.249")
16
+ # address = os.environ.get("address", "192.168.12.249")
15
17
  print(address)
16
- url = f"http://192.168.12.241/console/api/user_credentials"
18
+ url = f"{address}/console/api/user_credentials"
17
19
  print(url)
18
20
  headers = {
19
21
  'Content-Type': 'application/json', # 说明请求体是 JSON 格式
@@ -26,6 +28,10 @@ def store_key(key_name,key_value,user_name):
26
28
  }
27
29
  print(data)
28
30
  response = requests.post(url, headers=headers, json=data)
31
+ if response.status_code != 200:
32
+ print("请求失败,状态码:", response.status_code)
33
+ print(response.text)
34
+ return "failure"
29
35
  json = response.json()
30
36
  return json['certificate_key']
31
37
 
@@ -35,12 +41,13 @@ def get_key(key_name, user_name):
35
41
  key_name:凭证key
36
42
  user_name:用户名称
37
43
  """
38
- address = os.environ.get("address", "192.168.12.249")
39
- url = f"http://192.168.12.241/console/api/user_credentials?certificate_key={key_name}&user_name={user_name}"
44
+ # address = os.environ.get("address", "192.168.12.249")
45
+ url = f"{address}/console/api/user_credentials?certificate_key={key_name}&user_name={user_name}"
40
46
  print(url)
41
47
  response = requests.get(url)
42
48
  if response.status_code != 200:
43
49
  print("请求失败,状态码:", response.status_code)
50
+ print(response.text)
44
51
  return "failure"
45
52
  json = response.json()
46
53
 
@@ -52,8 +59,8 @@ def delete_key(key_name,user_name):
52
59
  key_name:凭证key
53
60
  user_name:用户名称
54
61
  """
55
- address = os.environ.get("address", "192.168.12.249")
56
- url = f"http://192.168.12.241/console/api/user_credentials"
62
+ # address = os.environ.get("address", "192.168.12.249")
63
+ url = f"{address}/console/api/user_credentials"
57
64
  print(url)
58
65
  headers = {
59
66
  'Content-Type': 'application/json', # 说明请求体是 JSON 格式
@@ -71,12 +78,13 @@ def list(user_name):
71
78
  获取所有凭证key
72
79
  user_name:用户名称
73
80
  """
74
- address = os.environ.get("address", "192.168.12.249")
75
- url = f"http://192.168.12.241/console/api/user_credentials/list?user_name={user_name}"
81
+ # address = os.environ.get("address", "192.168.12.249")
82
+ url = f"{address}/console/api/user_credentials/list?user_name={user_name}"
76
83
  print(url)
77
84
  response = requests.get(url)
78
85
  if response.status_code != 200:
79
86
  print("请求失败,状态码:", response.status_code)
87
+ print(response.text)
80
88
  return "failure"
81
89
  json = response.json()
82
90
 
@@ -88,11 +96,13 @@ def exist(key_name, user_name):
88
96
  key_name:凭证key
89
97
  user_name:用户名称
90
98
  """
91
- address = os.environ.get("address", "192.168.12.249")
92
- url = f"http://192.168.12.241/console/api/user_credentials?certificate_key={key_name}&user_name={user_name}"
99
+ # address = os.environ.get("address", "192.168.12.249")
100
+ url = f"{address}/console/api/user_credentials?certificate_key={key_name}&user_name={user_name}"
93
101
  print(url)
94
102
  response = requests.get(url)
95
103
  if response.status_code != 200:
104
+ print("请求失败,状态码:", response.status_code)
105
+ print(response.text)
96
106
  return False
97
107
 
98
108
 
isrpa/utils.py CHANGED
@@ -2,8 +2,10 @@ import os
2
2
 
3
3
  import requests
4
4
  import tldextract
5
+ from dotenv import load_dotenv
5
6
 
6
-
7
+ load_dotenv("/isearch/.env", override=True)
8
+ address = os.getenv("address")
7
9
  def getPath(user_name):
8
10
  """
9
11
  环境变量设置
@@ -17,9 +19,9 @@ def getPath(user_name):
17
19
  :return:
18
20
  """
19
21
 
20
- address = os.environ.get("address", "192.168.12.249")
22
+ # address = os.environ.get("address", "192.168.12.249")
21
23
 
22
- url = f"http://192.168.12.241/client/getPath"
24
+ url = f"{address}/client/getPath"
23
25
  print(url)
24
26
  headers = {
25
27
  'Content-Type': 'application/json', # 说明请求体是 JSON 格式
@@ -45,8 +47,8 @@ def upload_file(file_path, dest_file, user_name):
45
47
  :return:
46
48
  """
47
49
 
48
- address = os.environ.get("address", "192.168.12.249")
49
- url = f"http://192.168.12.241/client/noticeUpload"
50
+ # address = os.environ.get("address", "192.168.12.249")
51
+ url = f"{address}/client/noticeUpload"
50
52
  print(url)
51
53
  headers = {
52
54
  'Content-Type': 'application/json', # 说明请求体是 JSON 格式
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: isrpa
3
- Version: 0.9.3
3
+ Version: 0.9.5
4
4
  Summary: isrpa package
5
5
  Home-page: https://github.com/yourusername/mypackage
6
6
  Author: ysq
@@ -2,10 +2,10 @@ isrpa/OCR.py,sha256=nSDmVLo_z9GV7GUY57xBh2kumERG5_xtpUPxeF6ziQE,2509
2
2
  isrpa/Template.py,sha256=UP1uovLvJzXEPGo_hzLrIYOu3vZP8Cf6m3G2hGzQ6XA,1958
3
3
  isrpa/Template_Exception.py,sha256=an6eQ1NMB8a9R-J0yyMdwHIZcZeDtdV5f7fWKZQsZ3s,819
4
4
  isrpa/__init__.py,sha256=pG-YPVG0gJIJ6s4xcAz9S_CnUxpUcz33wl9eNUSgxGk,20
5
- isrpa/credentials.py,sha256=VZz4b8a5yY61UycCsF3aNhQvhILo63i0HnigeZeKxYA,2928
5
+ isrpa/credentials.py,sha256=_QXB4ZzJ_gnSJiCv1kA3B3i40j9kSI7cOjlQrH2Z8eg,3304
6
6
  isrpa/message.py,sha256=N0s6hMaC5S-Pi4EhwcSp-ngfBTBQyW6ymU9sI9dUSeE,11329
7
- isrpa/utils.py,sha256=MRRikKbksJVU8cY03bwxPiAq51BqYtcVPAjHCJcEGYc,51352
8
- isrpa-0.9.3.dist-info/METADATA,sha256=k8fcgcDT-VTOa9QFFibR3iEjB3KTo6KWSpHiSzmA-cI,511
9
- isrpa-0.9.3.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
10
- isrpa-0.9.3.dist-info/top_level.txt,sha256=J5HJbtR2WAeKnW1rrpkiuapwnlswv3RgM-riyZD87o0,6
11
- isrpa-0.9.3.dist-info/RECORD,,
7
+ isrpa/utils.py,sha256=uPCb1A1vDB0nTlII2BJz9kS0amk7mvzVA7ilI-UYA8Q,51439
8
+ isrpa-0.9.5.dist-info/METADATA,sha256=qO9iFu0KNh450zG_4NjC39mxVT09pvwTUz-gvCF5Mr8,511
9
+ isrpa-0.9.5.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
10
+ isrpa-0.9.5.dist-info/top_level.txt,sha256=J5HJbtR2WAeKnW1rrpkiuapwnlswv3RgM-riyZD87o0,6
11
+ isrpa-0.9.5.dist-info/RECORD,,
File without changes