aboutsummaryrefslogtreecommitdiffstats
path: root/hypervideo_dl/extractor/vrv.py
diff options
context:
space:
mode:
Diffstat (limited to 'hypervideo_dl/extractor/vrv.py')
-rw-r--r--hypervideo_dl/extractor/vrv.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/hypervideo_dl/extractor/vrv.py b/hypervideo_dl/extractor/vrv.py
index 89fa7af..523c442 100644
--- a/hypervideo_dl/extractor/vrv.py
+++ b/hypervideo_dl/extractor/vrv.py
@@ -8,7 +8,8 @@ import time
import urllib.parse
from .common import InfoExtractor
-from ..compat import compat_HTTPError, compat_urllib_parse_urlencode
+from ..compat import compat_urllib_parse_urlencode
+from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
float_or_none,
@@ -30,7 +31,7 @@ class VRVBaseIE(InfoExtractor):
base_url = self._API_DOMAIN + '/core/' + path
query = [
('oauth_consumer_key', self._API_PARAMS['oAuthKey']),
- ('oauth_nonce', ''.join([random.choice(string.ascii_letters) for _ in range(32)])),
+ ('oauth_nonce', ''.join(random.choices(string.ascii_letters, k=32))),
('oauth_signature_method', 'HMAC-SHA1'),
('oauth_timestamp', int(time.time())),
]
@@ -54,8 +55,8 @@ class VRVBaseIE(InfoExtractor):
'?'.join([base_url, encoded_query]), video_id,
note='Downloading %s JSON metadata' % note, headers=headers, data=data)
except ExtractorError as e:
- if isinstance(e.cause, compat_HTTPError) and e.cause.code == 401:
- raise ExtractorError(json.loads(e.cause.read().decode())['message'], expected=True)
+ if isinstance(e.cause, HTTPError) and e.cause.status == 401:
+ raise ExtractorError(json.loads(e.cause.response.read().decode())['message'], expected=True)
raise
def _call_cms(self, path, video_id, note):