101arrowz commited on
Commit
d395618
2 Parent(s): 0115766 b53a5ea
Files changed (1) hide show
  1. vox_celeb.py +10 -5
vox_celeb.py CHANGED
@@ -25,6 +25,8 @@ from itertools import repeat
25
  from multiprocessing import Manager, Pool, Process
26
  from pathlib import Path
27
  from shutil import copyfileobj
 
 
28
 
29
  import pandas as pd
30
  import requests
@@ -112,7 +114,6 @@ _PLACEHOLDER_MAPS = dict(
112
  for value in ((urls["placeholder"], urls["dev"]), (urls["test"], (urls["test"],)))
113
  )
114
 
115
-
116
  def _mp_download(
117
  url,
118
  tmp_path,
@@ -127,9 +128,11 @@ def _mp_download(
127
  headers = {}
128
  if resume_pos != 0:
129
  headers["Range"] = f"bytes={resume_pos}-"
130
- response = requests.get(
131
- url.format(key=cred_key), headers=headers, verify=False, stream=True
132
- )
 
 
133
  if response.status_code >= 200 and response.status_code < 300:
134
  for chunk in response.iter_content(chunk_size=65536):
135
  queue.put(len(chunk))
@@ -235,7 +238,9 @@ class VoxCeleb(datasets.GeneratorBasedBuilder):
235
  lengths = []
236
  start_positions = []
237
  for url in sources:
238
- head = requests.head(url.format(key=cred_key), verify=False, timeout=5)
 
 
239
  if head.status_code == 401:
240
  raise ValueError("failed to authenticate with VoxCeleb host")
241
  if head.status_code < 200 or head.status_code >= 300:
 
25
  from multiprocessing import Manager, Pool, Process
26
  from pathlib import Path
27
  from shutil import copyfileobj
28
+ from warnings import catch_warnings, filterwarnings
29
+ from urllib3.exceptions import InsecureRequestWarning
30
 
31
  import pandas as pd
32
  import requests
 
114
  for value in ((urls["placeholder"], urls["dev"]), (urls["test"], (urls["test"],)))
115
  )
116
 
 
117
  def _mp_download(
118
  url,
119
  tmp_path,
 
128
  headers = {}
129
  if resume_pos != 0:
130
  headers["Range"] = f"bytes={resume_pos}-"
131
+ with catch_warnings():
132
+ filterwarnings("ignore", category=InsecureRequestWarning)
133
+ response = requests.get(
134
+ url.format(key=cred_key), headers=headers, verify=False, stream=True
135
+ )
136
  if response.status_code >= 200 and response.status_code < 300:
137
  for chunk in response.iter_content(chunk_size=65536):
138
  queue.put(len(chunk))
 
238
  lengths = []
239
  start_positions = []
240
  for url in sources:
241
+ with catch_warnings():
242
+ filterwarnings("ignore", category=InsecureRequestWarning)
243
+ head = requests.get(url.format(key=cred_key), verify=False, timeout=5, stream=True)
244
  if head.status_code == 401:
245
  raise ValueError("failed to authenticate with VoxCeleb host")
246
  if head.status_code < 200 or head.status_code >= 300: