fixed parsing

This commit is contained in:
Hellow2
2023-06-13 13:29:24 +02:00
parent 500f82d079
commit 65f7121837
3 changed files with 12 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
from urllib.parse import urlparse
from urllib.parse import urlparse, ParseResult
import re
from .base_classes import Section, FloatAttribute, IntAttribute, BoolAttribute, ListAttribute, StringAttribute
@@ -26,8 +26,9 @@ class UrlStringAttribute(StringAttribute):
rule="has to be a valid url"
)
def single_object_from_element(self, value: str):
return urlparse(value)
@property
def object_from_value(self) -> ParseResult:
return urlparse(self.value)
class ConnectionSection(Section):

View File

@@ -91,7 +91,7 @@ if TOR:
'http': f'socks5h://127.0.0.1:{CONNECTION_SECTION.TOR_PORT.object_from_value}',
'https': f'socks5h://127.0.0.1:{CONNECTION_SECTION.TOR_PORT.object_from_value}'
}
INVIDIOUS_INSTANCE: ParseResult = CONNECTION_SECTION.INVIDIOUS_INSTANCE.value
INVIDIOUS_INSTANCE: ParseResult = CONNECTION_SECTION.INVIDIOUS_INSTANCE.object_from_value
# size of the chunks that are streamed
CHUNK_SIZE = CONNECTION_SECTION.CHUNK_SIZE.object_from_value