Fix curl download on Windows (#669)
This commit is contained in:
1 parent
fe5b3f8712
commit
3fcd365ba3
1 file changed
+1
-3
@@ -50,8 +50,7 @@ def gdrive_download(id='1n_oKgR81BJtqk75b00eAjdv03qVCQn2f', name='coco128.zip'):
|
|||||||
out = "NUL" if platform.system() == "Windows" else "/dev/null"
|
out = "NUL" if platform.system() == "Windows" else "/dev/null"
|
||||||
os.system('curl -c ./cookie -s -L "drive.google.com/uc?export=download&id=%s" > %s ' % (id, out))
|
os.system('curl -c ./cookie -s -L "drive.google.com/uc?export=download&id=%s" > %s ' % (id, out))
|
||||||
if os.path.exists('cookie'): # large file
|
if os.path.exists('cookie'): # large file
|
||||||
s = 'curl -Lb ./cookie "drive.google.com/uc?export=download&confirm=%s&id=%s" -o %s' % (
|
s = 'curl -Lb ./cookie "drive.google.com/uc?export=download&confirm=%s&id=%s" -o %s' % (get_token(), id, name)
|
||||||
get_token(), id, name)
|
|
||||||
else: # small file
|
else: # small file
|
||||||
s = 'curl -s -L -o %s "drive.google.com/uc?export=download&id=%s"' % (name, id)
|
s = 'curl -s -L -o %s "drive.google.com/uc?export=download&id=%s"' % (name, id)
|
||||||
r = os.system(s) # execute, capture return values
|
r = os.system(s) # execute, capture return values
|
||||||
@@ -80,7 +79,6 @@ def get_token(cookie="./cookie"):
|
|||||||
return line.split()[-1]
|
return line.split()[-1]
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
# def upload_blob(bucket_name, source_file_name, destination_blob_name):
|
# def upload_blob(bucket_name, source_file_name, destination_blob_name):
|
||||||
# # Uploads a file to a bucket
|
# # Uploads a file to a bucket
|
||||||
# # https://cloud.google.com/storage/docs/uploading-objects#storage-upload-object-python
|
# # https://cloud.google.com/storage/docs/uploading-objects#storage-upload-object-python
|
||||||
|
|||||||
Reference in new issue
Block a user