Merge pull request #30 from milahu/add-proxy-support

Add proxy support
pull/32/head^2
Langenfeld 2024-08-22 17:09:25 +02:00 zatwierdzone przez GitHub
commit ad08216ace
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
2 zmienionych plików z 15 dodań i 2 usunięć

Wyświetl plik

@ -21,7 +21,14 @@ class Gitea:
CREATE_TEAM = """/orgs/%s/teams""" # <orgname>
def __init__(
self, gitea_url: str, token_text=None, auth=None, verify=True, log_level="INFO"
self,
gitea_url: str,
token_text=None,
auth=None,
verify=True,
log_level="INFO",
# example: "socks5h://127.0.0.1:9050"
proxy=None,
):
"""Initializing Gitea-instance
@ -42,6 +49,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