Made my changes compliant to conventions

I used flake8 to make my code compliant to conventions used in the
project, and the community.
This commit is contained in:
Youssef Hajjioui 2022-01-29 19:38:32 -05:00
commit a394706c83
4 changed files with 6 additions and 4 deletions

View file

@ -113,6 +113,7 @@ from .version import __version__
if compat_os_name == 'nt': if compat_os_name == 'nt':
import ctypes import ctypes
class YoutubeDL(object): class YoutubeDL(object):
"""YoutubeDL class. """YoutubeDL class.
@ -824,7 +825,7 @@ class YoutubeDL(object):
self.report_error(compat_str(e), e.format_traceback()) self.report_error(compat_str(e), e.format_traceback())
except MaxDownloadsReached: except MaxDownloadsReached:
raise raise
except Forbidden403 as err: except Forbidden403:
# Lets not abuse of this 😜 we don't want to get brutal on the server # Lets not abuse of this 😜 we don't want to get brutal on the server
time.sleep(random.randint(3, 13)) time.sleep(random.randint(3, 13))
wrapper(self, *args, **kwargs) wrapper(self, *args, **kwargs)

View file

@ -481,5 +481,4 @@ def main(argv=None):
sys.exit('\nERROR: Interrupted by user') sys.exit('\nERROR: Interrupted by user')
__all__ = ['main', 'YoutubeDL', 'gen_extractors', 'list_extractors'] __all__ = ['main', 'YoutubeDL', 'gen_extractors', 'list_extractors']

View file

@ -2997,9 +2997,11 @@ else:
def compat_ctypes_WINFUNCTYPE(*args, **kwargs): def compat_ctypes_WINFUNCTYPE(*args, **kwargs):
return ctypes.WINFUNCTYPE(*args, **kwargs) return ctypes.WINFUNCTYPE(*args, **kwargs)
# Implement an error for which it is raise when error code 403 HTTPError # Implement an error for which it is raise when error code 403 HTTPError
class Forbidden403(Exception): class Forbidden403(Exception):
pass pass
__all__ = [ __all__ = [
'compat_HTMLParseError', 'compat_HTMLParseError',

View file

@ -187,7 +187,7 @@ class HttpFD(FileDownloader):
elif err.code != 403 and (err.code < 500 or err.code >= 600): elif err.code != 403 and (err.code < 500 or err.code >= 600):
# Unexpected HTTP error # Unexpected HTTP error
raise raise
elif err.code == 403: # The famous 403 Forbidden error elif err.code == 403: # The famous 403 Forbidden error
raise Forbidden403 raise Forbidden403
raise RetryDownload(err) raise RetryDownload(err)
except socket.error as err: except socket.error as err: