web3-multi-provider 2.2.5__tar.gz → 2.2.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: web3-multi-provider
3
- Version: 2.2.5
3
+ Version: 2.2.7
4
4
  Summary: Web3py provider that makes it easy to switch between different blockchain nodes to make sure application will be be online if main blockchain node will be unavailable.
5
5
  License: MIT
6
6
  Author: Raman
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "web3-multi-provider"
3
- version = "2.2.5"
3
+ version = "2.2.7"
4
4
  description = "Web3py provider that makes it easy to switch between different blockchain nodes to make sure application will be be online if main blockchain node will be unavailable."
5
5
  authors = ["Raman <raman.s@lido.fi>"]
6
6
  license = "MIT License"
@@ -41,3 +41,7 @@ profile = "black"
41
41
 
42
42
  [tool.pytest.ini_options]
43
43
  asyncio_default_fixture_loop_scope = "function"
44
+ markers = [
45
+ "http_mock: configures mocked HTTP responses for tests",
46
+ "integration: marks tests that hit real RPC endpoints",
47
+ ]
@@ -56,6 +56,14 @@ class AsyncHTTPProviderProxy(AsyncHTTPProvider):
56
56
  self._network: str = "" # to pass fetching of the chain_id
57
57
  self._uri: str = normalize_provider(str(self.endpoint_uri))
58
58
  self._layer = layer
59
+ self._request_session_manager: HTTPSessionManagerProxy = (
60
+ HTTPSessionManagerProxy(
61
+ chain_id=self._chain_id,
62
+ uri=self._uri,
63
+ network=self._network,
64
+ layer=self._layer,
65
+ )
66
+ )
59
67
 
60
68
  async def _ensure_chain_info_initialized(self) -> None:
61
69
  """
@@ -103,7 +103,7 @@ class AsyncBaseMultiProvider(AsyncJSONBaseProvider, ABC):
103
103
  ) -> RPCResponse:
104
104
  exceptions: list[Exception] = []
105
105
 
106
- for provider in provider_iter:
106
+ for index, provider in enumerate(provider_iter):
107
107
  try:
108
108
  response = await provider.make_request(method, params)
109
109
  except Exception as error: # pylint: disable=broad-except
@@ -111,6 +111,7 @@ class AsyncBaseMultiProvider(AsyncJSONBaseProvider, ABC):
111
111
  logger.warning(
112
112
  {
113
113
  "msg": "Provider not responding.",
114
+ "index": index,
114
115
  "error": str(error).replace(str(provider.endpoint_uri), "****"),
115
116
  }
116
117
  )
@@ -66,7 +66,12 @@ class HTTPProviderProxy(HTTPProvider):
66
66
  self._chain_id: str = ""
67
67
  self._network: str = ""
68
68
  self._session: Optional[Any] = session
69
- self._request_session_manager: Optional[HTTPSessionManagerProxy] = None
69
+ self._request_session_manager = HTTPSessionManagerProxy(
70
+ chain_id=self._chain_id,
71
+ uri=self._uri,
72
+ network=self._network,
73
+ layer=self._layer,
74
+ )
70
75
 
71
76
  def _ensure_chain_info_initialized(self) -> None:
72
77
  """
@@ -104,7 +104,7 @@ class BaseMultiProvider(JSONBaseProvider, ABC):
104
104
  ) -> RPCResponse:
105
105
  exceptions: list[Exception] = []
106
106
 
107
- for provider in provider_iter:
107
+ for index, provider in enumerate(provider_iter):
108
108
  try:
109
109
  response = provider.make_request(method, params)
110
110
  except Exception as error: # pylint: disable=broad-except
@@ -112,6 +112,7 @@ class BaseMultiProvider(JSONBaseProvider, ABC):
112
112
  logger.warning(
113
113
  {
114
114
  "msg": "Provider not responding.",
115
+ "index": index,
115
116
  "error": str(error).replace(str(provider.endpoint_uri), "****"),
116
117
  }
117
118
  )