mirror of
https://forge.fsky.io/oneflux/omegafox.git
synced 2026-02-10 16:52:05 -08:00
pythonlib: Default to http schema #57 0.3.4
Assume the proxy is using http schema when no other schema is specified.
This commit is contained in:
parent
f94452fa93
commit
347885e9cb
2 changed files with 4 additions and 2 deletions
|
|
@ -30,13 +30,15 @@ class Proxy:
|
||||||
"""
|
"""
|
||||||
Parses the proxy server string.
|
Parses the proxy server string.
|
||||||
"""
|
"""
|
||||||
proxy_match = re.match(r'^(?P<schema>\w+)://(?P<url>.*?)(?:\:(?P<port>\d+))?$', server)
|
proxy_match = re.match(r'^(?:(?P<schema>\w+)://)?(?P<url>.*?)(?:\:(?P<port>\d+))?$', server)
|
||||||
if not proxy_match:
|
if not proxy_match:
|
||||||
raise InvalidProxy(f"Invalid proxy server: {server}")
|
raise InvalidProxy(f"Invalid proxy server: {server}")
|
||||||
return proxy_match['schema'], proxy_match['url'], proxy_match['port']
|
return proxy_match['schema'], proxy_match['url'], proxy_match['port']
|
||||||
|
|
||||||
def as_string(self) -> str:
|
def as_string(self) -> str:
|
||||||
schema, url, port = self.parse_server(self.server)
|
schema, url, port = self.parse_server(self.server)
|
||||||
|
if not schema:
|
||||||
|
schema = 'http'
|
||||||
result = f"{schema}://"
|
result = f"{schema}://"
|
||||||
if self.username:
|
if self.username:
|
||||||
result += f"{self.username}"
|
result += f"{self.username}"
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
||||||
|
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "camoufox"
|
name = "camoufox"
|
||||||
version = "0.3.3"
|
version = "0.3.4"
|
||||||
description = "Wrapper around Playwright to help launch Camoufox"
|
description = "Wrapper around Playwright to help launch Camoufox"
|
||||||
authors = ["daijro <daijro.dev@gmail.com>"]
|
authors = ["daijro <daijro.dev@gmail.com>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue