def download_and_extract_nord_zipfile(ovpn_dir_path):
"""
This function retrieves NordVPN's zipfile, de-serializes & saves it.
Then it extracts the contents.
:param ovpn_dir_path: efault is the users {$HOME}/OVPN/ (%HOME%\OVPN\ on windows)
:return: NUTHIN'
"""
zip_data = urlopen('https://downloads.nordcdn.com/configs/archives/servers/ovpn.zip').read()
zipfile_path = os.path.join(ovpn_dir_path, 'zipfile.zip')
with open(zipfile_path, 'wb+') as nord_zipfile:
nord_zipfile.write(zip_data)
# sanity check
assert os.path.exists(zipfile_path)
# lololol This could be more than one line...buttfuckit
#TODO: also this can b dangerous AF. Need to make some checks before deserializing.
zipfile.ZipFile(zipfile_path).extractall(ovpn_dir_path)
评论列表
文章目录