MCPcopy Create free account
hub / github.com/NVIDIA/FastPhotoStyle / download_file_from_google_drive

Function download_file_from_google_drive

download_models.py:4–16  ·  view source on GitHub ↗
(id, destination)

Source from the content-addressed store, hash-verified

2import requests
3
4def download_file_from_google_drive(id, destination):
5 URL = "https://docs.google.com/uc?export=download"
6
7 session = requests.Session()
8
9 response = session.get(URL, params = { 'id' : id }, stream = True)
10 token = get_confirm_token(response)
11
12 if token:
13 params = { 'id' : id, 'confirm' : token }
14 response = session.get(URL, params = params, stream = True)
15
16 save_response_content(response, destination)
17
18def get_confirm_token(response):
19 for key, value in response.cookies.items():

Callers 1

download_models.pyFile · 0.85

Calls 2

get_confirm_tokenFunction · 0.85
save_response_contentFunction · 0.85

Tested by

no test coverage detected