filereader should use connection pool for file_exists (#31158)

* filereader should use connection pool for file_exists

* remove debug var
This commit is contained in:
Greg Hogan
2024-01-25 13:26:12 -08:00
committed by GitHub
parent 410db2cd9f
commit 6901aada14
+1 -2
View File
@@ -1,5 +1,4 @@
import os
import requests
from openpilot.tools.lib.url_file import URLFile
@@ -13,7 +12,7 @@ def resolve_name(fn):
def file_exists(fn):
fn = resolve_name(fn)
if fn.startswith(("http://", "https://")):
return requests.head(fn, allow_redirects=True).status_code == 200
return URLFile(fn).get_length_online() != -1
return os.path.exists(fn)
def FileReader(fn, debug=False):