from enum import IntEnum, unique @unique class ExitStatus(IntEnum): """Program exit status code constants.""" SUCCESS = 0 ERROR = 1 ERROR_TIMEOUT = 2 # See --check-status ERROR_HTTP_3XX = 3 ERROR_HTTP_4XX = 4 ERROR_HTTP_5XX = 5 ERROR_TOO_MANY_REDIRECTS = 6 PLUGIN_ERROR = 7 # 128+2 SIGINT # <http://www.tldp.org/LDP/abs/html/exitcodes.html> ERROR_CTRL_C = 130 def http_status_to_exit_status(http_status: int, follow=False) -> ExitStatus: """ Translate HTTP status code to exit status code. (Relevant only when invoked with --check-status or --download.) """ if 300 <= http_status <= 399 and not follow: # Redirect return ExitStatus.ERROR_HTTP_3XX elif 400 <= http_status <= 499: # Client Error return ExitStatus.ERROR_HTTP_4XX elif 500 <= http_status <= 599: # Server Error return ExitStatus.ERROR_HTTP_5XX else: return ExitStatus.SUCCESS
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
__pycache__ | Folder | 0755 |
|
|
cli | Folder | 0755 |
|
|
output | Folder | 0755 |
|
|
plugins | Folder | 0755 |
|
|
__init__.py | File | 132 B | 0644 |
|
__main__.py | File | 394 B | 0644 |
|
client.py | File | 10.15 KB | 0644 |
|
compat.py | File | 1.82 KB | 0644 |
|
config.py | File | 3.42 KB | 0644 |
|
context.py | File | 3.83 KB | 0644 |
|
core.py | File | 8.74 KB | 0644 |
|
downloads.py | File | 13.85 KB | 0644 |
|
encoding.py | File | 1.32 KB | 0644 |
|
models.py | File | 3.37 KB | 0644 |
|
sessions.py | File | 4.85 KB | 0644 |
|
ssl.py | File | 1.84 KB | 0644 |
|
status.py | File | 987 B | 0644 |
|
uploads.py | File | 4.01 KB | 0644 |
|
utils.py | File | 6.12 KB | 0644 |
|