Отключение IPv6 по умолчанию
This commit is contained in:
parent
f739ff3b1a
commit
72d7c69457
2 changed files with 10 additions and 0 deletions
|
|
@ -157,6 +157,9 @@ def main():
|
||||||
metavar="<User-Agent>",
|
metavar="<User-Agent>",
|
||||||
help=show_default(),
|
help=show_default(),
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--enable-ipv6", action="store_true", default=False, help=argparse.SUPPRESS
|
||||||
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
|
@ -207,7 +210,9 @@ def main():
|
||||||
print("Параметер url указан в неверном формате")
|
print("Параметер url указан в неверном формате")
|
||||||
return 1
|
return 1
|
||||||
domain = parsed_url.hostname
|
domain = parsed_url.hostname
|
||||||
|
|
||||||
session = Session()
|
session = Session()
|
||||||
|
core.setup_networking(args.enable_ipv6)
|
||||||
core.setup_session(session, cookies, DEFAULT_USER_AGENT, domain)
|
core.setup_session(session, cookies, DEFAULT_USER_AGENT, domain)
|
||||||
session.hooks = {"response": response_hook}
|
session.hooks = {"response": response_hook}
|
||||||
client = YandexMusicApi(session, domain)
|
client = YandexMusicApi(session, domain)
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ from pathlib import Path
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
import eyed3
|
import eyed3
|
||||||
|
import requests
|
||||||
from eyed3.id3.frames import ImageFrame
|
from eyed3.id3.frames import ImageFrame
|
||||||
from requests import Session
|
from requests import Session
|
||||||
|
|
||||||
|
|
@ -83,6 +84,10 @@ def set_id3_tags(
|
||||||
tag.save()
|
tag.save()
|
||||||
|
|
||||||
|
|
||||||
|
def setup_networking(enable_ipv6: bool):
|
||||||
|
requests.packages.urllib3.util.connection.HAS_IPV6 = enable_ipv6 # type: ignore
|
||||||
|
|
||||||
|
|
||||||
def setup_session(
|
def setup_session(
|
||||||
session: Session, cookie_jar: CookieJar, user_agent: str, domain: str
|
session: Session, cookie_jar: CookieJar, user_agent: str, domain: str
|
||||||
) -> Session:
|
) -> Session:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue