Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include spgci/py.typed
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "spgci"
version = "0.0.50"
version = "0.0.51"
description = "SPGCI is an API Client for the S&P Commodity Insights REST API"
authors = ["S&P Global Commodity Insights <pl_api_support@spglobal.com>"]
license = "Apache-2.0"
Expand Down Expand Up @@ -34,4 +34,4 @@ build-backend = "poetry.core.masonry.api"
[tool.pytest.ini_options]
markers = [
"integtest",
]
]
19 changes: 18 additions & 1 deletion spgci/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,30 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from functools import lru_cache

import spgci.config as config
import requests
from requests.exceptions import HTTPError, SSLError
import warnings
from tenacity import retry, retry_if_exception_type, wait_fixed
from spgci.exceptions import AuthError, PerSecondLimitError, DailyLimitError
from typing import TYPE_CHECKING


if TYPE_CHECKING:
from collections.abc import Callable
from typing import TypeVar


_CachedFn = TypeVar("_CachedFn", bound=Callable)

def lru_cache() -> Callable[[_CachedFn], _CachedFn]:
"""Ensure that the type hints still work after calling the lru_cache decorator."""
pass

else:
from functools import lru_cache


_throttle_retry = retry(
retry=retry_if_exception_type(PerSecondLimitError), reraise=True, wait=wait_fixed(1)
Expand Down
Empty file added spgci/py.typed
Empty file.