atomicshop 2.12.6__py3-none-any.whl → 2.12.7__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.

Potentially problematic release.


This version of atomicshop might be problematic. Click here for more details.

atomicshop/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  """Atomic Basic functions and classes to make developer life easier"""
2
2
 
3
3
  __author__ = "Den Kras"
4
- __version__ = '2.12.6'
4
+ __version__ = '2.12.7'
atomicshop/web.py CHANGED
@@ -144,12 +144,13 @@ def get_page_content(
144
144
  return result
145
145
 
146
146
 
147
- def download(file_url: str, target_directory: str, file_name: str = None, **kwargs) -> str:
147
+ def download(file_url: str, target_directory: str = None, file_name: str = None, **kwargs) -> str:
148
148
  """
149
149
  The function receives url and target filesystem directory to download the file.
150
150
 
151
151
  :param file_url: full URL to download the file.
152
152
  :param target_directory: The directory on the filesystem to save the file to.
153
+ If not specified, temporary directory will be used.
153
154
  :param file_name: string, file name (example: file.zip) that you want the downloaded file to be saved as.
154
155
  If not specified, the default filename from 'file_url' will be used.
155
156
  :return: string, full file path of downloaded file. If download failed, 'None' will be returned.
@@ -170,6 +171,10 @@ def download(file_url: str, target_directory: str, file_name: str = None, **kwar
170
171
  # Get only the filename from URL.
171
172
  file_name = get_filename_from_url(file_url=file_url)
172
173
 
174
+ # If 'target_directory' wasn't specified, we will use the temporary directory.
175
+ if not target_directory:
176
+ target_directory = filesystem.get_temp_directory()
177
+
173
178
  # Build full path to file.
174
179
  file_path: str = f'{target_directory}{os.sep}{file_name}'
175
180
 
@@ -1,11 +1,13 @@
1
1
  import requests
2
- import os
2
+ from bs4 import BeautifulSoup
3
3
  import subprocess
4
- import tempfile
4
+
5
+ from .. import web, filesystem
6
+ from ..print_api import print_api
5
7
 
6
8
 
7
9
  # URL to the PyCharm Community Edition download page
8
- PYCHARM_DOWNLOAD_URL = 'https://www.jetbrains.com/pycharm/download/download-thanks.html?platform=windows&code=PCC'
10
+ PYCHARM_DOWNLOAD_URL = 'https://www.jetbrains.com/pycharm/download/#section=windowsC'
9
11
 
10
12
 
11
13
  def download_install_main():
@@ -27,30 +29,53 @@ def download_install_main():
27
29
  main()
28
30
  """
29
31
 
30
- # Get the redirect URL for the download
31
- response = requests.get(PYCHARM_DOWNLOAD_URL, allow_redirects=True)
32
+ def get_latest_pycharm_download_link():
33
+ url = "https://www.jetbrains.com/pycharm/download/"
34
+ headers = {
35
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
36
+ }
37
+
38
+ response = requests.get(url, headers=headers)
39
+ if response.status_code != 200:
40
+ raise Exception("Failed to load the download page")
41
+
42
+ soup = BeautifulSoup(response.text, 'html.parser')
43
+ download_link = None
32
44
 
33
- # Extract the final download URL
34
- download_url = response.url
45
+ # Find the Professional version download link
46
+ for a in soup.find_all('a', href=True):
47
+ if '/download?code=PCC&platform=windows' in a['href']:
48
+ download_link = a['href']
49
+ break
35
50
 
36
- # Get the file name from the download URL
37
- file_name = download_url.split('/')[-1]
51
+ if not download_link:
52
+ raise Exception("Could not find the download link for the latest version of PyCharm Professional")
38
53
 
39
- # Create a temporary directory to download the installer
40
- temp_dir = tempfile.mkdtemp()
41
- installer_path = os.path.join(temp_dir, file_name)
54
+ return f"https:{download_link}"
42
55
 
43
- # Download the installer
44
- print(f"Downloading {file_name}...")
45
- with requests.get(download_url, stream=True) as r:
46
- r.raise_for_status()
47
- with open(installer_path, 'wb') as f:
48
- for chunk in r.iter_content(chunk_size=8192):
49
- f.write(chunk)
50
- print("Download complete.")
56
+ installer_path: str = None
57
+ try:
58
+ print_api("Fetching the latest PyCharm download link...")
59
+ download_url = get_latest_pycharm_download_link()
60
+ print_api(f"Download URL: {download_url}")
61
+
62
+ print_api("Starting the download...")
63
+ file_name = "pycharm-latest.exe"
64
+ # download_file(download_url, file_name)
65
+ installer_path = web.download(file_url=download_url, file_name=file_name)
66
+ print_api(f"Downloaded the latest version of PyCharm to {file_name}", color='green')
67
+ except Exception as e:
68
+ print_api(f"An error occurred: {e}")
69
+
70
+ if not installer_path:
71
+ print_api("Failed to download the latest version of PyCharm", color='red')
72
+ return 1
51
73
 
52
74
  # Install PyCharm
53
75
  # Run the installer
54
- print("Running the installer...")
76
+ print_api("Running the installer...")
55
77
  subprocess.run([installer_path, '/S'], check=True) # /S for silent installation
56
- print("Installation complete.")
78
+ print_api("Installation complete.", color='green')
79
+
80
+ # Remove the installer
81
+ filesystem.remove_file(installer_path)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: atomicshop
3
- Version: 2.12.6
3
+ Version: 2.12.7
4
4
  Summary: Atomic functions and classes to make developer life easier
5
5
  Author: Denis Kras
6
6
  License: MIT License
@@ -29,10 +29,11 @@ Classifier: Intended Audience :: Developers
29
29
  Classifier: License :: OSI Approved :: MIT License
30
30
  Classifier: Programming Language :: Python :: 3
31
31
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
32
- Requires-Python: >=3.10
32
+ Requires-Python: >=3.11
33
33
  Description-Content-Type: text/markdown
34
34
  License-File: LICENSE.txt
35
35
  Requires-Dist: wheel
36
+ Requires-Dist: beautifulsoup4
36
37
  Requires-Dist: cryptography
37
38
  Requires-Dist: dnslib
38
39
  Requires-Dist: dnspython
@@ -1,4 +1,4 @@
1
- atomicshop/__init__.py,sha256=TLPRMvhKFttMuXR3ePlfcfwTL8XQTiNL0vl1IZUyWUE,123
1
+ atomicshop/__init__.py,sha256=VtHYlLlN7pxaTolCwS2FFKqGO6Ur-1C_x40kN8DdUSk,123
2
2
  atomicshop/_basics_temp.py,sha256=6cu2dd6r2dLrd1BRNcVDKTHlsHs_26Gpw8QS6v32lQ0,3699
3
3
  atomicshop/_create_pdf_demo.py,sha256=Yi-PGZuMg0RKvQmLqVeLIZYadqEZwUm-4A9JxBl_vYA,3713
4
4
  atomicshop/_patch_import.py,sha256=ENp55sKVJ0e6-4lBvZnpz9PQCt3Otbur7F6aXDlyje4,6334
@@ -44,7 +44,7 @@ atomicshop/timer.py,sha256=KxBBgVM8po6pUJDW8TgY1UXj0iiDmRmL5XDCq0VHAfU,1670
44
44
  atomicshop/urls.py,sha256=CQl1j1kjEVDlAuYJqYD9XxPF1SUSgrmG8PjlcXNEKsQ,597
45
45
  atomicshop/uuids.py,sha256=JSQdm3ZTJiwPQ1gYe6kU0TKS_7suwVrHc8JZDGYlydM,2214
46
46
  atomicshop/virtualization.py,sha256=LPP4vjE0Vr10R6DA4lqhfX_WaNdDGRAZUW0Am6VeGco,494
47
- atomicshop/web.py,sha256=Ks_4F02MUqGvFRC-gs2H_NHk3jf1XIzrf_Q_NFb3re4,11116
47
+ atomicshop/web.py,sha256=mc8k7tLpBqT7fSN3JTCEpeZ43fDemy_-7kzwVnS2350,11360
48
48
  atomicshop/addons/PlayWrightCodegen.cmd,sha256=Z5cnllsyXD4F1W2h-WLEnyFkg5nZy0-hTGHRWXVOuW4,173
49
49
  atomicshop/addons/ScriptExecution.cmd,sha256=8iC-uHs9MX9qUD_C2M7n9Xw4MZvwOfxT8H5v3hluVps,93
50
50
  atomicshop/addons/a_setup_scripts/install_psycopg2_ubuntu.sh,sha256=lM7LkXQ2AxfFzDGyzSOfIS_zpg9bAD1k3JJ-qu5CdH8,81
@@ -156,7 +156,7 @@ atomicshop/wrappers/numpyw.py,sha256=sBV4gSKyr23kXTalqAb1oqttzE_2XxBooCui66jbAqc
156
156
  atomicshop/wrappers/olefilew.py,sha256=biD5m58rogifCYmYhJBrAFb9O_Bn_spLek_9HofLeYE,2051
157
157
  atomicshop/wrappers/pipw.py,sha256=mu4jnHkSaYNfpBiLZKMZxEX_E2LqW5BVthMZkblPB_c,1317
158
158
  atomicshop/wrappers/process_wrapper_pbtk.py,sha256=ycPmBRnv627RWks6N8OhxJQe8Gu3h3Vwj-4HswPOw0k,599
159
- atomicshop/wrappers/pycharmw.py,sha256=Ar7SDG15HD-GUiLH-Mclo7xpoPj9nzSXg4ks63lL8fw,1642
159
+ atomicshop/wrappers/pycharmw.py,sha256=OHcaVlyhIqhgRioPhkeS5krDZ_NezZjpBCvyRiLjWwI,2723
160
160
  atomicshop/wrappers/pyopensslw.py,sha256=OBWxA6EJ2vU_Qlf4M8m6ilcG3hyYB4yB0EsXUf7NhEU,6804
161
161
  atomicshop/wrappers/ubuntu_terminal.py,sha256=BBZD3EH6KSDORd5IZBZM-ti4U6Qh1sZwftx42s7hqB4,10917
162
162
  atomicshop/wrappers/wslw.py,sha256=AKphiHLSddL7ErevUowr3f9Y1AgGz_R3KZ3NssW07h8,6959
@@ -251,8 +251,8 @@ atomicshop/wrappers/socketw/socket_server_tester.py,sha256=AhpurHJmP2kgzHaUbq5ey
251
251
  atomicshop/wrappers/socketw/socket_wrapper.py,sha256=aXBwlEIJhFT0-c4i8iNlFx2It9VpCEpsv--5Oqcpxao,11624
252
252
  atomicshop/wrappers/socketw/ssl_base.py,sha256=k4V3gwkbq10MvOH4btU4onLX2GNOsSfUAdcHmL1rpVE,2274
253
253
  atomicshop/wrappers/socketw/statistics_csv.py,sha256=t3dtDEfN47CfYVi0CW6Kc2QHTEeZVyYhc57IYYh5nmA,826
254
- atomicshop-2.12.6.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
255
- atomicshop-2.12.6.dist-info/METADATA,sha256=10_ghq5UFkTcqxD9GFqX7Bov01aZvlg4N7XRktoDL9s,10447
256
- atomicshop-2.12.6.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
257
- atomicshop-2.12.6.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
258
- atomicshop-2.12.6.dist-info/RECORD,,
254
+ atomicshop-2.12.7.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
255
+ atomicshop-2.12.7.dist-info/METADATA,sha256=PYR2CLumnvb7Z6kYi6LUxxItCf2lSRoWm258X9-ZQZk,10478
256
+ atomicshop-2.12.7.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
257
+ atomicshop-2.12.7.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
258
+ atomicshop-2.12.7.dist-info/RECORD,,