File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 6
6
"""
7
7
8
8
import logging
9
- from typing import Dict , Iterator
9
+ from typing import Dict , Iterator , Tuple
10
10
from urllib import parse
11
11
12
12
# Imports
@@ -43,7 +43,7 @@ def __init__(self) -> None:
43
43
# improve efficiency, but avoiding sharing state between different
44
44
# hosts-scheme combinations to minimize subtle security issues.
45
45
# Some cookies may not be HTTP-safe.
46
- self ._sessions : Dict [str , requests .Session ] = {}
46
+ self ._sessions : Dict [Tuple [ str , str ] , requests .Session ] = {}
47
47
48
48
# Default settings
49
49
self .socket_timeout : int = 4 # seconds
@@ -118,10 +118,10 @@ def _get_session(self, url: str) -> requests.Session:
118
118
# reuse connections while minimizing subtle security issues.
119
119
parsed_url = parse .urlparse (url )
120
120
121
- if not parsed_url .scheme or not parsed_url . hostname :
121
+ if not parsed_url .scheme :
122
122
raise exceptions .DownloadError (f"Failed to parse URL { url } " )
123
123
124
- session_index = f" { parsed_url .scheme } + { parsed_url .hostname } "
124
+ session_index = ( parsed_url .scheme , parsed_url .hostname or "" )
125
125
session = self ._sessions .get (session_index )
126
126
127
127
if not session :
You can’t perform that action at this time.
0 commit comments