Skip to content

Commit

Permalink
use constant
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinheavey committed Dec 2, 2021
1 parent 27ac69c commit 7327a7d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/solana/rpc/providers/async_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

from ..types import RPCMethod, RPCResponse
from .async_base import AsyncBaseProvider
from .core import _HTTPProviderCore
from .core import _HTTPProviderCore, DEFAULT_TIMEOUT


class AsyncHTTPProvider(AsyncBaseProvider, _HTTPProviderCore):
"""Async HTTP provider to interact with the http rpc endpoint."""

def __init__(self, endpoint: Optional[str] = None, timeout: float = 10):
def __init__(self, endpoint: Optional[str] = None, timeout: float = DEFAULT_TIMEOUT):
"""Init AsyncHTTPProvider."""
super().__init__(endpoint)
self.session = httpx.AsyncClient(timeout=timeout)
Expand Down
4 changes: 3 additions & 1 deletion src/solana/rpc/providers/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from .._utils.encoding import FriendlyJsonSerde
from ..types import URI, RPCMethod, RPCResponse

DEFAULT_TIMEOUT = 10


def get_default_endpoint() -> URI:
"""Get the default http rpc endpoint."""
Expand All @@ -19,7 +21,7 @@ def get_default_endpoint() -> URI:
class _HTTPProviderCore(FriendlyJsonSerde):
logger = logging.getLogger("solanaweb3.rpc.httprpc.HTTPClient")

def __init__(self, endpoint: Optional[str] = None, timeout: float = 10):
def __init__(self, endpoint: Optional[str] = None, timeout: float = DEFAULT_TIMEOUT):
"""Init."""
self._request_counter = itertools.count()
self.endpoint_uri = get_default_endpoint() if not endpoint else URI(endpoint)
Expand Down

0 comments on commit 7327a7d

Please sign in to comment.