Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow configuration of internal parameters #947

Merged
merged 4 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion gnosis/eth/clients/ens_client.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from typing import Any, Dict, List, Optional, Union

import requests
Expand All @@ -22,7 +23,9 @@ def __init__(self, network_id: int):
else: # Fallback to mainnet
url = "https://api.thegraph.com/subgraphs/name/ensdomains/ens/"
self.url = url
self.request_timeout = 5 # Seconds
self.request_timeout = int(
os.environ.get("ENS_CLIENT_REQUEST_TIMEOUT", 5)
) # Seconds
self.request_session = requests.Session()

def is_available(self) -> bool:
Expand Down
5 changes: 4 additions & 1 deletion gnosis/eth/clients/etherscan_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import os
import time
from typing import Any, Dict, Optional
from urllib.parse import urljoin
Expand Down Expand Up @@ -115,7 +116,9 @@ def __init__(
self,
network: EthereumNetwork,
api_key: Optional[str] = None,
request_timeout: int = 10,
request_timeout: int = int(
os.environ.get("ETHERSCAN_CLIENT_REQUEST_TIMEOUT", 10)
),
):
self.network = network
self.api_key = api_key
Expand Down
5 changes: 4 additions & 1 deletion gnosis/eth/clients/sourcify_client.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from typing import Any, Dict, List, Optional
from urllib.parse import urljoin

Expand Down Expand Up @@ -34,7 +35,9 @@ def __init__(
network: EthereumNetwork = EthereumNetwork.MAINNET,
base_url_api: str = "https://sourcify.dev",
base_url_repo: str = "https://repo.sourcify.dev/",
request_timeout: int = 10,
request_timeout: int = int(
os.environ.get("SOURCIFY_CLIENT_REQUEST_TIMEOUT", 10)
),
):
self.network = network
self.base_url_api = base_url_api
Expand Down
3 changes: 2 additions & 1 deletion gnosis/safe/api/base_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from abc import ABC
from typing import Dict, Optional
from urllib.parse import urljoin
Expand All @@ -24,7 +25,7 @@ def __init__(
network: EthereumNetwork,
ethereum_client: Optional[EthereumClient] = None,
base_url: Optional[str] = None,
request_timeout: int = 10,
request_timeout: int = int(os.environ.get("SAFE_BASE_API_REQUEST_TIMEOUT", 10)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that would be better define this timeout in the childs, intead here.
I mean something like SAFE_TRANSACTION_SERVICE_REQUEST_TIMEOUT, and the same for the relay, but not sure if will be continued.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relay is discontinued, we should remove it. But I agree on defining this variable for every child

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in TransactionServiceApi. RelayServiceApi will be removed in this PR.

):
"""
:param network: Network for the transaction service
Expand Down
Loading