add proxy support

pull/30/head
Milan Hauth 2024-07-27 16:42:00 +02:00
rodzic 33137fd185
commit 1be0b45f26
2 zmienionych plików z 9 dodań i 1 usunięć

Wyświetl plik

@ -28,6 +28,8 @@ class Gitea:
auth=None,
verify=True,
log_level="INFO",
# example: "socks5h://127.0.0.1:9050"
proxy=None,
):
"""Initializing Gitea-instance
@ -48,6 +50,12 @@ class Gitea:
self.url = gitea_url
self.requests = requests.Session()
if proxy:
self.requests.proxies = {
"http": proxy,
"https": proxy,
}
# Manage authentification
if not token_text and not auth:
raise ValueError("Please provide auth or token_text, but not both")

Wyświetl plik

@ -1,3 +1,3 @@
requests
requests[socks]
pytest
immutabledict