How to download file/family using pyRevit

I want to create a simple script to download file/family from website or cloud storage. I manage to create it using requests package, when I run it from pyCharm it works just fine, but it’s not working when I run it from pyRevit.

__title__ = "Test"
__fullframeengine__ = True

import os.path
import requests

user_path = os.path.expanduser('~')

def download_file(durl):
        with requests.get(durl) as req:
            filename = req.url[durl.rfind('/')+1:]
            path = os.path.join(user_path, 'Downloads', filename)
            with open(path, 'wb') as f:
                for chunk in req.iter_content(chunk_size=8192):
                    if chunk:
            return filename
    except Exception as e:
        print e
        return None
famurl = ''


It was showing some error when I try run in from pyRevit

HTTPSConnectionPool(host=‘’, port=443): Max retries exceeded with url: /wiki/Pepe_the_Frog (Caused by NewConnectionError(‘<VerifiedHTTPSConnection object at 0x00000000000040C1>: Failed to establish a new connection: [Errno 10013] An attempt was made to access a socket in a way forbidden by its access permissions’,))

If anyone have a solution or similar problem, please share. Thank you.