kopia lustrzana https://github.com/Langenfeld/py-gitea
add proxy support
rodzic
33137fd185
commit
1be0b45f26
|
@ -28,6 +28,8 @@ class Gitea:
|
||||||
auth=None,
|
auth=None,
|
||||||
verify=True,
|
verify=True,
|
||||||
log_level="INFO",
|
log_level="INFO",
|
||||||
|
# example: "socks5h://127.0.0.1:9050"
|
||||||
|
proxy=None,
|
||||||
):
|
):
|
||||||
"""Initializing Gitea-instance
|
"""Initializing Gitea-instance
|
||||||
|
|
||||||
|
@ -48,6 +50,12 @@ class Gitea:
|
||||||
self.url = gitea_url
|
self.url = gitea_url
|
||||||
self.requests = requests.Session()
|
self.requests = requests.Session()
|
||||||
|
|
||||||
|
if proxy:
|
||||||
|
self.requests.proxies = {
|
||||||
|
"http": proxy,
|
||||||
|
"https": proxy,
|
||||||
|
}
|
||||||
|
|
||||||
# Manage authentification
|
# Manage authentification
|
||||||
if not token_text and not auth:
|
if not token_text and not auth:
|
||||||
raise ValueError("Please provide auth or token_text, but not both")
|
raise ValueError("Please provide auth or token_text, but not both")
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
requests
|
requests[socks]
|
||||||
pytest
|
pytest
|
||||||
immutabledict
|
immutabledict
|
Ładowanie…
Reference in New Issue