Skip to content

Commit 387dcd2

Browse files
authoredMar 12, 2025··
Merge pull request #158 from omarryhan/feature/add-proxy
Feature/add proxy
2 parents 8688c01 + a5886b6 commit 387dcd2

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed
 

‎aiogoogle/__version__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
__about__ = "Async Google API client"
33
__description__ = __about__
44
__url__ = "https://github.com/omarryhan/aiogoogle"
5-
__version_info__ = ("5", "14", "1")
5+
__version_info__ = ("5", "15", "0")
66
__version__ = ".".join(__version_info__)
77
__author__ = "Omar Ryhan"
88
__author_email__ = "omarryhan@gmail.com"

‎aiogoogle/auth/managers.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ async def detect_default_creds_source(self):
12611261
url=GCE_METADATA_IP_ROOT,
12621262
headers=GCE_METADATA_HEADERS,
12631263
timeout=GCE_METADATA_DEFAULT_TIMEOUT,
1264-
_verify_ssl=False
1264+
_verify_ssl=False,
12651265
), full_res=True)
12661266
except Exception:
12671267
raise RuntimeError(
@@ -1316,7 +1316,7 @@ async def _get_oauth2_authorization_grant(self):
13161316
data=parse.urlencode({
13171317
"assertion": google_auth_lib_creds._make_authorization_grant_assertion(),
13181318
"grant_type": JWT_GRANT_TYPE
1319-
}).encode("utf-8")
1319+
}).encode("utf-8"),
13201320
))
13211321

13221322
if not json_res.get('access_token'):

‎aiogoogle/models.py

+1
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ class Request:
175175
_verify_ssl (boolean): Defaults to True.
176176
177177
upload_file_content_type (str): Optional content-type header string. In case you don't want to use the default application/octet-stream (Or whatever is auto-detected by your transport handler)
178+
178179
"""
179180

180181
def __init__(

‎aiogoogle/sessions/aiohttp_session.py

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
from ..models import Response
1313
from .abc import AbstractSession
14+
import os
15+
16+
HTTP_PROXY = os.getenv("AIOGOOGLE_HTTP_PROXY", "")
1417

1518

1619
async def _get_file_size(full_file_path):
@@ -126,6 +129,7 @@ async def fire_request(request):
126129
data=mpwriter,
127130
timeout=request.timeout,
128131
ssl=request._verify_ssl,
132+
proxy=HTTP_PROXY,
129133
)
130134
# Else load file to memory and send
131135
else:
@@ -140,6 +144,7 @@ async def fire_request(request):
140144
json=request.json,
141145
timeout=request.timeout,
142146
ssl=request._verify_ssl,
147+
proxy=HTTP_PROXY
143148
)
144149
# Else, if no file upload
145150
else:
@@ -151,6 +156,7 @@ async def fire_request(request):
151156
json=request.json,
152157
timeout=request.timeout,
153158
ssl=request._verify_ssl,
159+
proxy=HTTP_PROXY,
154160
)
155161

156162
# ----------------- send sequence ------------------#

0 commit comments

Comments
 (0)
Please sign in to comment.