Skip to content
This repository was archived by the owner on Jun 30, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions youtubesearchpython/core/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@ def __init__(self):
self.data = None
self.timeout = 2
self.proxy = {}
http_proxy = os.environ.get("HTTP_PROXY")
if http_proxy:
self.proxy["http://"] = http_proxy
https_proxy = os.environ.get("HTTPS_PROXY")
if https_proxy:
self.proxy["https://"] = https_proxy

socks_proxy = os.environ.get("SOCKS_PROXY")
if socks_proxy:
self.proxy = socks_proxy

if self.proxy == {}:
http_proxy = os.environ.get("HTTP_PROXY")
if http_proxy:
self.proxy["http://"] = http_proxy
https_proxy = os.environ.get("HTTPS_PROXY")
if https_proxy:
self.proxy["https://"] = https_proxy

def syncPostRequest(self) -> httpx.Response:
return httpx.post(
Expand Down