update.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:ovpn-speed-connect 作者: N2ITN 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号