vnai 0.0.9__py3-none-any.whl → 0.1.0__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.
vnai/__init__.py CHANGED
@@ -14,6 +14,7 @@ from cryptography.fernet import Fernet
14
14
  TC_VAR = "ACCEPT_TC"
15
15
  TC_VAL = "tôi đồng ý"
16
16
 
17
+ lmt = os.path.sep
17
18
  HOME_DIR = pathlib.Path.home()
18
19
  PROJECT_DIR = HOME_DIR / ".vnstock"
19
20
  ID_DIR = PROJECT_DIR / 'id'
@@ -82,6 +83,7 @@ class VnstockInitializer:
82
83
  self.project_dir = PROJECT_DIR
83
84
  self.id_dir = ID_DIR
84
85
  self.terms_file_path = TC_PATH
86
+ self.env_config = ID_DIR / "environment.json"
85
87
  self.RH = 'asejruyy^&%$#W2vX>NfwrevDRESWR'
86
88
  self.LH = 'YMAnhuytr%$59u90y7j-mjhgvyFTfbiuUYH'
87
89
 
@@ -90,7 +92,7 @@ class VnstockInitializer:
90
92
  self.id_dir.mkdir(exist_ok=True)
91
93
  self.target = target
92
94
 
93
- kb = (str(self.project_dir).split("/")[-1] + str(self.id_dir).split("/")[-1] + str(self.terms_file_path).split("/")[-1]).ljust(32)[:32].encode('utf-8')
95
+ kb = (str(self.project_dir).split(lmt)[-1] + str(self.id_dir).split(lmt)[-1] + str(self.terms_file_path).split(lmt)[-1]).ljust(32)[:32].encode('utf-8')
94
96
  kb64 = base64.urlsafe_b64encode(kb)
95
97
  self.cph = Fernet(kb64)
96
98
 
@@ -228,7 +230,7 @@ class VnstockInitializer:
228
230
  }
229
231
 
230
232
  # save data to a json file in id folder
231
- with open(self.id_dir / "environment.json", "w", encoding="utf-8") as f:
233
+ with open(self.env_config, "w", encoding="utf-8") as f:
232
234
  f.write(json.dumps(data, indent=4))
233
235
 
234
236
  try:
@@ -240,7 +242,7 @@ class VnstockInitializer:
240
242
  """
241
243
  Checks if terms and conditions are accepted.
242
244
  """
243
- if not self.terms_file_path.exists():
245
+ if not self.env_config.exists() or not self.terms_file_path.exists():
244
246
  # If not, ask for acceptance
245
247
  accepted = self.show_terms_and_conditions()
246
248
  if not accepted:
@@ -1,6 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vnai
3
- Version: 0.0.9
3
+ Version: 0.1.0
4
+ Summary: :))
4
5
  Author: Vnstock HQ
5
6
  Author-email: support@vnstock.site
6
7
  Classifier: Programming Language :: Python :: 3
@@ -0,0 +1,5 @@
1
+ vnai/__init__.py,sha256=WB7Q0BUTLYHRFPdg2RPsNU9WrHX7BofOHwIQ6DzwHjE,17618
2
+ vnai-0.1.0.dist-info/METADATA,sha256=MdGTjI0sGCYkqlp9KzFzQBQ1C7zSVkcn-mZ2cSr-7Bk,589
3
+ vnai-0.1.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
4
+ vnai-0.1.0.dist-info/top_level.txt,sha256=4zI0qZHePCwvgSqXl4420sBcd0VzZn4MEcRsAIFae3k,5
5
+ vnai-0.1.0.dist-info/RECORD,,
@@ -1,5 +0,0 @@
1
- vnai/__init__.py,sha256=BGi5-_wnIkcGphRtGkNlHHS8fRwA05y5WXAU9Fr7cj0,17531
2
- vnai-0.0.9.dist-info/METADATA,sha256=K2eEY0ZRPAYweXQmohagUKN-cv4UXp-FCDtI7yACBOo,576
3
- vnai-0.0.9.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
4
- vnai-0.0.9.dist-info/top_level.txt,sha256=4zI0qZHePCwvgSqXl4420sBcd0VzZn4MEcRsAIFae3k,5
5
- vnai-0.0.9.dist-info/RECORD,,
File without changes