Creates a new Proxy. Args: raw: Raw proxy data. If None, default class values are used.
(self, raw: dict | None = None)
| 114 | """SOCKS proxy version.""" |
| 115 | |
| 116 | def __init__(self, raw: dict | None = None): |
| 117 | """Creates a new Proxy. |
| 118 | |
| 119 | Args: |
| 120 | raw: Raw proxy data. If None, default class values are used. |
| 121 | """ |
| 122 | if raw is None: |
| 123 | return |
| 124 | if not isinstance(raw, dict): |
| 125 | raise TypeError(f"`raw` must be a dict, got {type(raw)}") |
| 126 | if raw.get("proxyType"): |
| 127 | self.proxy_type = ProxyType.load(raw["proxyType"]) |
| 128 | if raw.get("httpProxy"): |
| 129 | self.http_proxy = raw["httpProxy"] |
| 130 | if raw.get("noProxy"): |
| 131 | self.no_proxy = raw["noProxy"] |
| 132 | if raw.get("proxyAutoconfigUrl"): |
| 133 | self.proxy_autoconfig_url = raw["proxyAutoconfigUrl"] |
| 134 | if raw.get("sslProxy"): |
| 135 | self.ssl_proxy = raw["sslProxy"] |
| 136 | if raw.get("autodetect"): |
| 137 | self.auto_detect = raw["autodetect"] |
| 138 | if raw.get("socksProxy"): |
| 139 | self.socks_proxy = raw["socksProxy"] |
| 140 | if raw.get("socksUsername"): |
| 141 | self.socks_username = raw["socksUsername"] |
| 142 | if raw.get("socksPassword"): |
| 143 | self.socks_password = raw["socksPassword"] |
| 144 | if raw.get("socksVersion"): |
| 145 | self.socks_version = raw["socksVersion"] |
| 146 | |
| 147 | @property |
| 148 | def proxy_type(self): |