(20241204) Trying display name and display picture fetch from GMail.

This commit is contained in:
2024-12-04 14:34:21 +05:30
parent f15a638251
commit 91831bd7f5
4 changed files with 282 additions and 8 deletions
+15 -5
View File
@@ -88,6 +88,7 @@ class AsyncNimbusSMS:
sender_id,
user_id,
api_key,
http_client: httpx.AsyncClient = None,
debug = True,
debug_prefix = "Nimbus SMS | "
):
@@ -98,6 +99,8 @@ class AsyncNimbusSMS:
:param sender_id: The 6-char code like "HDFCBK", "NSESMS", "ZRODHA" that you see in your SMS inbox.
:param user_id: The 6-digit id that Nimbus has assigned to you.
:param api_key: The API key generated through Nimbus's portal.
:param http_client: An instance of 'httpx' library's AsyncClient. If not given, one will be instantiated
internally. It is recommended that, for multi-auth use cases, you provide a common HTTP client from outside.
:param debug: Whether, or not, you would like to show debugging messages (can be changed on the fly).
:param debug_prefix: The prefix text to show with the debug string.
"""
@@ -107,12 +110,19 @@ class AsyncNimbusSMS:
if not debug: self.__printer.disable()
# Create an HTTP client to work with:
limits = httpx.Limits(
max_connections = 5,
max_keepalive_connections = 5,
keepalive_expiry = 3600
if http_client: self.__http_client = http_client
else: self.__http_client = httpx.AsyncClient(
limits = httpx.Limits(
max_connections = 100, # ............ Maximum number of connections allowed in the pool.
max_keepalive_connections = 50, # ... Maximum number of connections that can be kept alive.
),
timeout = httpx.Timeout(
pool = 120.0, # .... Time to wait for a free connection from the pool.
connect = 2.5, # ... Time to wait for establishing a connection to the server.
write = 10.0, # .... Time to wait for sending data.
read = 2.5 # ....... Time to wait for receiving data.
)
)
self.__http_client = httpx.AsyncClient(limits = limits, timeout = 120)
# Capture the input config:
self.__entity_id = entity_id