provider.named
Documentation for eth_defi.provider.named Python module.
Helper methods to extract the URL endpoint and name of a provider.
See also
Functions
|
Get loggable name of the JSON-RPC provider. |
Classes
A base class for getting a JSON-RPC provider name and URL. |
- class BaseNamedProvider
Bases:
abc.ABC,web3.providers.base.JSONBaseProviderA base class for getting a JSON-RPC provider name and URL.
- abstract property endpoint_uri: str
Return the active node URI endpoint.
Warning
Endpoint URIs often contain API keys. They should be never publicly displayed as is.
- property call_endpoint_uri: str
Return the active node URI where call JSON-RPCs go.
Warning
Endpoint URIs often contain API keys. They should be never publicly displayed as is.
- request_func(w3, middleware_onion)
@param w3 is the web3 instance @param middleware_onion is an iterable of middleware,
ordered by first to execute
- @returns a function that calls all the middleware and
eventually self.make_request()
- NamedProvider: TypeAlias = eth_defi.provider.named.BaseNamedProvider | web3.providers.rpc.rpc.HTTPProvider
Named providers including web3.py core providers
- get_provider_name(provider)
Get loggable name of the JSON-RPC provider.
Strips out API keys from the URL of a JSON-RPC API provider.
Supports
eth_deficustomer provider classes as well asweb3core providers.Example:
print(get_provider_name(web3.provider))
- Returns
HTTP provider URL’s domain name if available.
Assume any API keys are not part of the domain name.
- Parameters
provider (web3.providers.base.BaseProvider) –
- Return type