From 82a2015b1f567ed0567c09e684246d6dd1d7765a Mon Sep 17 00:00:00 2001 From: Dev Bear Date: Thu, 8 May 2025 12:36:50 -0400 Subject: [PATCH 1/8] bet --- README.md | 16 ++-- src/examples/basic.py | 14 +-- src/{client => furthermore_py}/__init__.py | 0 src/{client => furthermore_py}/client.py | 60 ++++++------ uv.lock | 105 ++++++++++++++++++++- 5 files changed, 149 insertions(+), 46 deletions(-) rename src/{client => furthermore_py}/__init__.py (100%) rename src/{client => furthermore_py}/client.py (82%) diff --git a/README.md b/README.md index 610c6a9..f27b339 100644 --- a/README.md +++ b/README.md @@ -47,27 +47,27 @@ This client provides methods to interact with the Furthermore API endpoints for ```bash export FURTHERMORE_API_KEY="your_actual_api_key_here" ``` - Alternatively, you can pass the `api_key` directly when initializing the `FurthermoreClient`. + Alternatively, you can pass the `api_key` directly when initializing the `Client`. ## Usage -Here's a basic example of how to use the `FurthermoreClient`: +Here's a basic example of how to use the `Client`: ```python import os import logging -from src.client import FurthermoreClient # Adjust import based on your project structure +from furthermore_py import Client # Adjust import based on your project structure if __name__ == '__main__': # Ensure API key is set - api_key = os.getenv(FurthermoreClient.FURTHERMORE_API_KEY_ENV_VAR) + api_key = os.getenv(Client.FURTHERMORE_API_KEY_ENV_VAR) if not api_key: - print(f"CRITICAL: The environment variable '{FurthermoreClient.FURTHERMORE_API_KEY_ENV_VAR}' is not set.") - print(f"Please set it before running this example (e.g., export {FurthermoreClient.FURTHERMORE_API_KEY_ENV_VAR}=your_key).") + print(f"CRITICAL: The environment variable '{Client.FURTHERMORE_API_KEY_ENV_VAR}' is not set.") + print(f"Please set it before running this example (e.g., export {Client.FURTHERMORE_API_KEY_ENV_VAR}=your_key).") exit() # Optional: Configure logging for the example - example_logger = logging.getLogger("FurthermoreClientExample") + example_logger = logging.getLogger("ClientExample") example_logger.setLevel(logging.INFO) if not example_logger.hasHandlers(): ch = logging.StreamHandler() @@ -76,7 +76,7 @@ if __name__ == '__main__': example_logger.addHandler(ch) example_logger.propagate = False # Avoid duplicate logs if root logger is configured - client = FurthermoreClient(logger=example_logger) + client = Client(logger=example_logger) try: print("\nFetching articles (first 3 vaults):") diff --git a/src/examples/basic.py b/src/examples/basic.py index f359eaa..14ccad7 100644 --- a/src/examples/basic.py +++ b/src/examples/basic.py @@ -3,25 +3,25 @@ import requests -from src.client import FurthermoreClient +from furthermore_py import Client # Basic Example - Run this script directly to test the collector if __name__ == "__main__": print("Attempting to use FurthermoreCo lector (Example Usage)...") - api_key_present = os.getenv(FurthermoreClient.FURTHERMORE_API_KEY_ENV_VAR) + api_key_present = os.getenv(Client.FURTHERMORE_API_KEY_ENV_VAR) if not api_key_present: print( - f"CRITICAL: The environment variable '{FurthermoreClient.FURTHERMORE_API_KEY_ENV_VAR}' is not set." + f"CRITICAL: The environment variable '{Client.FURTHERMORE_API_KEY_ENV_VAR}' is not set." ) print( - "Please set it before running this example (e.g., export {FurthermoreClient.FURTHERMORE_API_KEY_ENV_VAR}=your_key)." + "Please set it before running this example (e.g., export {Client.FURTHERMORE_API_KEY_ENV_VAR}=your_key)." ) else: print( - f"Environment variable '{FurthermoreClient.FURTHERMORE_API_KEY_ENV_VAR}' is set." + f"Environment variable '{Client.FURTHERMORE_API_KEY_ENV_VAR}' is set." ) - example_logger = logging.getLogger("FurthermoreClientExample") + example_logger = logging.getLogger("ClientExample") example_logger.setLevel(logging.INFO) if not example_logger.hasHandlers(): ch = logging.StreamHandler() @@ -31,7 +31,7 @@ ch.setFormatter(formatter) example_logger.addHandler(ch) example_logger.propagate = False - client = FurthermoreClient(logger=example_logger) + client = Client(logger=example_logger) try: print("\nFetching articles (first 3 vaults):") diff --git a/src/client/__init__.py b/src/furthermore_py/__init__.py similarity index 100% rename from src/client/__init__.py rename to src/furthermore_py/__init__.py diff --git a/src/client/client.py b/src/furthermore_py/client.py similarity index 82% rename from src/client/client.py rename to src/furthermore_py/client.py index 07b4816..6410342 100644 --- a/src/client/client.py +++ b/src/furthermore_py/client.py @@ -37,7 +37,7 @@ def __init__( logger: logging.Logger | None = None, ): """ - Initializes the FurthermoreClient. + Initializes the Client. Args: base_url: The base URL for the Furthermore API. @@ -64,7 +64,7 @@ def __init__( "Content-Type": "application/json", } self.logger.info( - f"FurthermoreClient initialized with base URL: {self.base_url}" + f"Client initialized with base URL: {self.base_url}" ) def _make_request( @@ -122,7 +122,7 @@ def _make_request( ) raise - def get_articles( + def get_vaults( self, offset: int = 0, limit: int = 10, @@ -130,7 +130,7 @@ def get_articles( sort_direction: str | None = None, ) -> dict[str, Any]: """ - Fetches a list of articles (vaults) from the API's `/vaults` endpoint. + Fetches a list of vaults from the API's `/vaults` endpoint. Args: offset: Number of records to skip (for pagination). @@ -172,7 +172,7 @@ def get_bgt_prices(self) -> dict[str, Any]: def get_sources(self, vault_limit_for_scan: int = 100) -> dict[str, set[str]]: """ Extracts unique source names (protocols and incentivizers) by analyzing vault data. - This method calls `get_articles` to fetch a sample of vaults and extracts + This method calls `get_vaults` to fetch a sample of vaults and extracts protocol and incentivizer names from their metadata. Args: @@ -191,30 +191,32 @@ def get_sources(self, vault_limit_for_scan: int = 100) -> dict[str, set[str]]: protocols: set[str] = set() incentivizers: set[str] = set() try: - vault_data = self.get_articles(limit=vault_limit_for_scan) - - if "vaults" in vault_data and isinstance(vault_data["vaults"], list): - for vault in vault_data["vaults"]: - metadata = vault.get("metadata") - if isinstance(metadata, dict): - protocol_name = metadata.get("protocolName") - if protocol_name: - protocols.add(protocol_name) - - # Check metadata.protocol.name as per API response structure - protocol_info = metadata.get("protocol") - if isinstance(protocol_info, dict) and protocol_info.get( - "name" - ): - protocols.add(protocol_info["name"]) - - incentivizer_info = metadata.get("incentivizer") - if ( - isinstance(incentivizer_info, dict) - and incentivizer_info.get("name") - and incentivizer_info["name"].strip() - ): - incentivizers.add(incentivizer_info["name"].strip()) + # Corrected method call from get_articles to get_vaults + vault_data = self.get_vaults(limit=vault_limit_for_scan) + + for vault in vault_data.get("vaults", []): + metadata = vault.get("metadata") + if not isinstance(metadata, dict): + continue # Skip if metadata is not a dictionary or missing + + # Extract from metadata.protocolName + if p_name_direct := metadata.get("protocolName"): + if isinstance(p_name_direct, str) and p_name_direct.strip(): + protocols.add(p_name_direct.strip()) + + # Extract from metadata.protocol.name + if protocol_obj := metadata.get("protocol"): + if isinstance(protocol_obj, dict): + if p_name_nested := protocol_obj.get("name"): + if isinstance(p_name_nested, str) and p_name_nested.strip(): + protocols.add(p_name_nested.strip()) + + # Extract from metadata.incentivizer.name + if incentivizer_obj := metadata.get("incentivizer"): + if isinstance(incentivizer_obj, dict): + if i_name := incentivizer_obj.get("name"): + if isinstance(i_name, str) and i_name.strip(): + incentivizers.add(i_name.strip()) self.logger.info( f"Found {len(protocols)} unique protocols and {len(incentivizers)} unique incentivizers." diff --git a/uv.lock b/uv.lock index 246c788..1049594 100644 --- a/uv.lock +++ b/uv.lock @@ -1,6 +1,6 @@ version = 1 revision = 2 -requires-python = ">=3.13" +requires-python = ">=3.10" [[package]] name = "build" @@ -8,8 +8,10 @@ version = "1.2.2.post1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "colorama", marker = "os_name == 'nt'" }, + { name = "importlib-metadata", marker = "python_full_version < '3.10.2'" }, { name = "packaging" }, { name = "pyproject-hooks" }, + { name = "tomli", marker = "python_full_version < '3.11'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/7d/46/aeab111f8e06793e4f0e421fcad593d547fb8313b50990f31681ee2fb1ad/build-1.2.2.post1.tar.gz", hash = "sha256:b36993e92ca9375a219c99e606a122ff365a760a2d4bba0caa09bd5278b608b7", size = 46701, upload-time = "2024-10-06T17:22:25.251Z" } wheels = [ @@ -31,6 +33,45 @@ version = "3.4.2" source = { registry = "https://pypi.org/simple" } sdist = { url = "https://files.pythonhosted.org/packages/e4/33/89c2ced2b67d1c2a61c19c6751aa8902d46ce3dacb23600a283619f5a12d/charset_normalizer-3.4.2.tar.gz", hash = "sha256:5baececa9ecba31eff645232d59845c07aa030f0c81ee70184a90d35099a0e63", size = 126367, upload-time = "2025-05-02T08:34:42.01Z" } wheels = [ + { url = "https://files.pythonhosted.org/packages/95/28/9901804da60055b406e1a1c5ba7aac1276fb77f1dde635aabfc7fd84b8ab/charset_normalizer-3.4.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:7c48ed483eb946e6c04ccbe02c6b4d1d48e51944b6db70f697e089c193404941", size = 201818, upload-time = "2025-05-02T08:31:46.725Z" }, + { url = "https://files.pythonhosted.org/packages/d9/9b/892a8c8af9110935e5adcbb06d9c6fe741b6bb02608c6513983048ba1a18/charset_normalizer-3.4.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b2d318c11350e10662026ad0eb71bb51c7812fc8590825304ae0bdd4ac283acd", size = 144649, upload-time = "2025-05-02T08:31:48.889Z" }, + { url = "https://files.pythonhosted.org/packages/7b/a5/4179abd063ff6414223575e008593861d62abfc22455b5d1a44995b7c101/charset_normalizer-3.4.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9cbfacf36cb0ec2897ce0ebc5d08ca44213af24265bd56eca54bee7923c48fd6", size = 155045, upload-time = "2025-05-02T08:31:50.757Z" }, + { url = "https://files.pythonhosted.org/packages/3b/95/bc08c7dfeddd26b4be8c8287b9bb055716f31077c8b0ea1cd09553794665/charset_normalizer-3.4.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:18dd2e350387c87dabe711b86f83c9c78af772c748904d372ade190b5c7c9d4d", size = 147356, upload-time = "2025-05-02T08:31:52.634Z" }, + { url = "https://files.pythonhosted.org/packages/a8/2d/7a5b635aa65284bf3eab7653e8b4151ab420ecbae918d3e359d1947b4d61/charset_normalizer-3.4.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8075c35cd58273fee266c58c0c9b670947c19df5fb98e7b66710e04ad4e9ff86", size = 149471, upload-time = "2025-05-02T08:31:56.207Z" }, + { url = "https://files.pythonhosted.org/packages/ae/38/51fc6ac74251fd331a8cfdb7ec57beba8c23fd5493f1050f71c87ef77ed0/charset_normalizer-3.4.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5bf4545e3b962767e5c06fe1738f951f77d27967cb2caa64c28be7c4563e162c", size = 151317, upload-time = "2025-05-02T08:31:57.613Z" }, + { url = "https://files.pythonhosted.org/packages/b7/17/edee1e32215ee6e9e46c3e482645b46575a44a2d72c7dfd49e49f60ce6bf/charset_normalizer-3.4.2-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:7a6ab32f7210554a96cd9e33abe3ddd86732beeafc7a28e9955cdf22ffadbab0", size = 146368, upload-time = "2025-05-02T08:31:59.468Z" }, + { url = "https://files.pythonhosted.org/packages/26/2c/ea3e66f2b5f21fd00b2825c94cafb8c326ea6240cd80a91eb09e4a285830/charset_normalizer-3.4.2-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:b33de11b92e9f75a2b545d6e9b6f37e398d86c3e9e9653c4864eb7e89c5773ef", size = 154491, upload-time = "2025-05-02T08:32:01.219Z" }, + { url = "https://files.pythonhosted.org/packages/52/47/7be7fa972422ad062e909fd62460d45c3ef4c141805b7078dbab15904ff7/charset_normalizer-3.4.2-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:8755483f3c00d6c9a77f490c17e6ab0c8729e39e6390328e42521ef175380ae6", size = 157695, upload-time = "2025-05-02T08:32:03.045Z" }, + { url = "https://files.pythonhosted.org/packages/2f/42/9f02c194da282b2b340f28e5fb60762de1151387a36842a92b533685c61e/charset_normalizer-3.4.2-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:68a328e5f55ec37c57f19ebb1fdc56a248db2e3e9ad769919a58672958e8f366", size = 154849, upload-time = "2025-05-02T08:32:04.651Z" }, + { url = "https://files.pythonhosted.org/packages/67/44/89cacd6628f31fb0b63201a618049be4be2a7435a31b55b5eb1c3674547a/charset_normalizer-3.4.2-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:21b2899062867b0e1fde9b724f8aecb1af14f2778d69aacd1a5a1853a597a5db", size = 150091, upload-time = "2025-05-02T08:32:06.719Z" }, + { url = "https://files.pythonhosted.org/packages/1f/79/4b8da9f712bc079c0f16b6d67b099b0b8d808c2292c937f267d816ec5ecc/charset_normalizer-3.4.2-cp310-cp310-win32.whl", hash = "sha256:e8082b26888e2f8b36a042a58307d5b917ef2b1cacab921ad3323ef91901c71a", size = 98445, upload-time = "2025-05-02T08:32:08.66Z" }, + { url = "https://files.pythonhosted.org/packages/7d/d7/96970afb4fb66497a40761cdf7bd4f6fca0fc7bafde3a84f836c1f57a926/charset_normalizer-3.4.2-cp310-cp310-win_amd64.whl", hash = "sha256:f69a27e45c43520f5487f27627059b64aaf160415589230992cec34c5e18a509", size = 105782, upload-time = "2025-05-02T08:32:10.46Z" }, + { url = "https://files.pythonhosted.org/packages/05/85/4c40d00dcc6284a1c1ad5de5e0996b06f39d8232f1031cd23c2f5c07ee86/charset_normalizer-3.4.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:be1e352acbe3c78727a16a455126d9ff83ea2dfdcbc83148d2982305a04714c2", size = 198794, upload-time = "2025-05-02T08:32:11.945Z" }, + { url = "https://files.pythonhosted.org/packages/41/d9/7a6c0b9db952598e97e93cbdfcb91bacd89b9b88c7c983250a77c008703c/charset_normalizer-3.4.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:aa88ca0b1932e93f2d961bf3addbb2db902198dca337d88c89e1559e066e7645", size = 142846, upload-time = "2025-05-02T08:32:13.946Z" }, + { url = "https://files.pythonhosted.org/packages/66/82/a37989cda2ace7e37f36c1a8ed16c58cf48965a79c2142713244bf945c89/charset_normalizer-3.4.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d524ba3f1581b35c03cb42beebab4a13e6cdad7b36246bd22541fa585a56cccd", size = 153350, upload-time = "2025-05-02T08:32:15.873Z" }, + { url = "https://files.pythonhosted.org/packages/df/68/a576b31b694d07b53807269d05ec3f6f1093e9545e8607121995ba7a8313/charset_normalizer-3.4.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:28a1005facc94196e1fb3e82a3d442a9d9110b8434fc1ded7a24a2983c9888d8", size = 145657, upload-time = "2025-05-02T08:32:17.283Z" }, + { url = "https://files.pythonhosted.org/packages/92/9b/ad67f03d74554bed3aefd56fe836e1623a50780f7c998d00ca128924a499/charset_normalizer-3.4.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fdb20a30fe1175ecabed17cbf7812f7b804b8a315a25f24678bcdf120a90077f", size = 147260, upload-time = "2025-05-02T08:32:18.807Z" }, + { url = "https://files.pythonhosted.org/packages/a6/e6/8aebae25e328160b20e31a7e9929b1578bbdc7f42e66f46595a432f8539e/charset_normalizer-3.4.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0f5d9ed7f254402c9e7d35d2f5972c9bbea9040e99cd2861bd77dc68263277c7", size = 149164, upload-time = "2025-05-02T08:32:20.333Z" }, + { url = "https://files.pythonhosted.org/packages/8b/f2/b3c2f07dbcc248805f10e67a0262c93308cfa149a4cd3d1fe01f593e5fd2/charset_normalizer-3.4.2-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:efd387a49825780ff861998cd959767800d54f8308936b21025326de4b5a42b9", size = 144571, upload-time = "2025-05-02T08:32:21.86Z" }, + { url = "https://files.pythonhosted.org/packages/60/5b/c3f3a94bc345bc211622ea59b4bed9ae63c00920e2e8f11824aa5708e8b7/charset_normalizer-3.4.2-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:f0aa37f3c979cf2546b73e8222bbfa3dc07a641585340179d768068e3455e544", size = 151952, upload-time = "2025-05-02T08:32:23.434Z" }, + { url = "https://files.pythonhosted.org/packages/e2/4d/ff460c8b474122334c2fa394a3f99a04cf11c646da895f81402ae54f5c42/charset_normalizer-3.4.2-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:e70e990b2137b29dc5564715de1e12701815dacc1d056308e2b17e9095372a82", size = 155959, upload-time = "2025-05-02T08:32:24.993Z" }, + { url = "https://files.pythonhosted.org/packages/a2/2b/b964c6a2fda88611a1fe3d4c400d39c66a42d6c169c924818c848f922415/charset_normalizer-3.4.2-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:0c8c57f84ccfc871a48a47321cfa49ae1df56cd1d965a09abe84066f6853b9c0", size = 153030, upload-time = "2025-05-02T08:32:26.435Z" }, + { url = "https://files.pythonhosted.org/packages/59/2e/d3b9811db26a5ebf444bc0fa4f4be5aa6d76fc6e1c0fd537b16c14e849b6/charset_normalizer-3.4.2-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:6b66f92b17849b85cad91259efc341dce9c1af48e2173bf38a85c6329f1033e5", size = 148015, upload-time = "2025-05-02T08:32:28.376Z" }, + { url = "https://files.pythonhosted.org/packages/90/07/c5fd7c11eafd561bb51220d600a788f1c8d77c5eef37ee49454cc5c35575/charset_normalizer-3.4.2-cp311-cp311-win32.whl", hash = "sha256:daac4765328a919a805fa5e2720f3e94767abd632ae410a9062dff5412bae65a", size = 98106, upload-time = "2025-05-02T08:32:30.281Z" }, + { url = "https://files.pythonhosted.org/packages/a8/05/5e33dbef7e2f773d672b6d79f10ec633d4a71cd96db6673625838a4fd532/charset_normalizer-3.4.2-cp311-cp311-win_amd64.whl", hash = "sha256:e53efc7c7cee4c1e70661e2e112ca46a575f90ed9ae3fef200f2a25e954f4b28", size = 105402, upload-time = "2025-05-02T08:32:32.191Z" }, + { url = "https://files.pythonhosted.org/packages/d7/a4/37f4d6035c89cac7930395a35cc0f1b872e652eaafb76a6075943754f095/charset_normalizer-3.4.2-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:0c29de6a1a95f24b9a1aa7aefd27d2487263f00dfd55a77719b530788f75cff7", size = 199936, upload-time = "2025-05-02T08:32:33.712Z" }, + { url = "https://files.pythonhosted.org/packages/ee/8a/1a5e33b73e0d9287274f899d967907cd0bf9c343e651755d9307e0dbf2b3/charset_normalizer-3.4.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cddf7bd982eaa998934a91f69d182aec997c6c468898efe6679af88283b498d3", size = 143790, upload-time = "2025-05-02T08:32:35.768Z" }, + { url = "https://files.pythonhosted.org/packages/66/52/59521f1d8e6ab1482164fa21409c5ef44da3e9f653c13ba71becdd98dec3/charset_normalizer-3.4.2-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:fcbe676a55d7445b22c10967bceaaf0ee69407fbe0ece4d032b6eb8d4565982a", size = 153924, upload-time = "2025-05-02T08:32:37.284Z" }, + { url = "https://files.pythonhosted.org/packages/86/2d/fb55fdf41964ec782febbf33cb64be480a6b8f16ded2dbe8db27a405c09f/charset_normalizer-3.4.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d41c4d287cfc69060fa91cae9683eacffad989f1a10811995fa309df656ec214", size = 146626, upload-time = "2025-05-02T08:32:38.803Z" }, + { url = "https://files.pythonhosted.org/packages/8c/73/6ede2ec59bce19b3edf4209d70004253ec5f4e319f9a2e3f2f15601ed5f7/charset_normalizer-3.4.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4e594135de17ab3866138f496755f302b72157d115086d100c3f19370839dd3a", size = 148567, upload-time = "2025-05-02T08:32:40.251Z" }, + { url = "https://files.pythonhosted.org/packages/09/14/957d03c6dc343c04904530b6bef4e5efae5ec7d7990a7cbb868e4595ee30/charset_normalizer-3.4.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:cf713fe9a71ef6fd5adf7a79670135081cd4431c2943864757f0fa3a65b1fafd", size = 150957, upload-time = "2025-05-02T08:32:41.705Z" }, + { url = "https://files.pythonhosted.org/packages/0d/c8/8174d0e5c10ccebdcb1b53cc959591c4c722a3ad92461a273e86b9f5a302/charset_normalizer-3.4.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:a370b3e078e418187da8c3674eddb9d983ec09445c99a3a263c2011993522981", size = 145408, upload-time = "2025-05-02T08:32:43.709Z" }, + { url = "https://files.pythonhosted.org/packages/58/aa/8904b84bc8084ac19dc52feb4f5952c6df03ffb460a887b42615ee1382e8/charset_normalizer-3.4.2-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:a955b438e62efdf7e0b7b52a64dc5c3396e2634baa62471768a64bc2adb73d5c", size = 153399, upload-time = "2025-05-02T08:32:46.197Z" }, + { url = "https://files.pythonhosted.org/packages/c2/26/89ee1f0e264d201cb65cf054aca6038c03b1a0c6b4ae998070392a3ce605/charset_normalizer-3.4.2-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:7222ffd5e4de8e57e03ce2cef95a4c43c98fcb72ad86909abdfc2c17d227fc1b", size = 156815, upload-time = "2025-05-02T08:32:48.105Z" }, + { url = "https://files.pythonhosted.org/packages/fd/07/68e95b4b345bad3dbbd3a8681737b4338ff2c9df29856a6d6d23ac4c73cb/charset_normalizer-3.4.2-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:bee093bf902e1d8fc0ac143c88902c3dfc8941f7ea1d6a8dd2bcb786d33db03d", size = 154537, upload-time = "2025-05-02T08:32:49.719Z" }, + { url = "https://files.pythonhosted.org/packages/77/1a/5eefc0ce04affb98af07bc05f3bac9094513c0e23b0562d64af46a06aae4/charset_normalizer-3.4.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:dedb8adb91d11846ee08bec4c8236c8549ac721c245678282dcb06b221aab59f", size = 149565, upload-time = "2025-05-02T08:32:51.404Z" }, + { url = "https://files.pythonhosted.org/packages/37/a0/2410e5e6032a174c95e0806b1a6585eb21e12f445ebe239fac441995226a/charset_normalizer-3.4.2-cp312-cp312-win32.whl", hash = "sha256:db4c7bf0e07fc3b7d89ac2a5880a6a8062056801b83ff56d8464b70f65482b6c", size = 98357, upload-time = "2025-05-02T08:32:53.079Z" }, + { url = "https://files.pythonhosted.org/packages/6c/4f/c02d5c493967af3eda9c771ad4d2bbc8df6f99ddbeb37ceea6e8716a32bc/charset_normalizer-3.4.2-cp312-cp312-win_amd64.whl", hash = "sha256:5a9979887252a82fefd3d3ed2a8e3b937a7a809f65dcb1e068b090e165bbe99e", size = 105776, upload-time = "2025-05-02T08:32:54.573Z" }, { url = "https://files.pythonhosted.org/packages/ea/12/a93df3366ed32db1d907d7593a94f1fe6293903e3e92967bebd6950ed12c/charset_normalizer-3.4.2-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:926ca93accd5d36ccdabd803392ddc3e03e6d4cd1cf17deff3b989ab8e9dbcf0", size = 199622, upload-time = "2025-05-02T08:32:56.363Z" }, { url = "https://files.pythonhosted.org/packages/04/93/bf204e6f344c39d9937d3c13c8cd5bbfc266472e51fc8c07cb7f64fcd2de/charset_normalizer-3.4.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:eba9904b0f38a143592d9fc0e19e2df0fa2e41c3c3745554761c5f6447eedabf", size = 143435, upload-time = "2025-05-02T08:32:58.551Z" }, { url = "https://files.pythonhosted.org/packages/22/2a/ea8a2095b0bafa6c5b5a55ffdc2f924455233ee7b91c69b7edfcc9e02284/charset_normalizer-3.4.2-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3fddb7e2c84ac87ac3a947cb4e66d143ca5863ef48e4a5ecb83bd48619e4634e", size = 153653, upload-time = "2025-05-02T08:33:00.342Z" }, @@ -58,7 +99,7 @@ wheels = [ [[package]] name = "furthermore-py" -version = "0.1.1" +version = "0.1.2" source = { virtual = "." } dependencies = [ { name = "requests" }, @@ -88,6 +129,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/76/c6/c88e154df9c4e1a2a66ccf0005a88dfb2650c1dffb6f5ce603dfbd452ce3/idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3", size = 70442, upload-time = "2024-09-15T18:07:37.964Z" }, ] +[[package]] +name = "importlib-metadata" +version = "8.7.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "zipp" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/76/66/650a33bd90f786193e4de4b3ad86ea60b53c89b669a5c7be931fac31cdb0/importlib_metadata-8.7.0.tar.gz", hash = "sha256:d13b81ad223b890aa16c5471f2ac3056cf76c5f10f82d6f9292f0b415f389000", size = 56641, upload-time = "2025-04-27T15:29:01.736Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/20/b0/36bd937216ec521246249be3bf9855081de4c5e06a0c9b4219dbeda50373/importlib_metadata-8.7.0-py3-none-any.whl", hash = "sha256:e5dd1551894c77868a30651cef00984d50e1002d06942a7101d34870c5f02afd", size = 27656, upload-time = "2025-04-27T15:29:00.214Z" }, +] + [[package]] name = "packaging" version = "25.0" @@ -146,6 +199,45 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/cd/be/f6b790d6ae98f1f32c645f8540d5c96248b72343b0a56fab3a07f2941897/ruff-0.11.8-py3-none-win_arm64.whl", hash = "sha256:304432e4c4a792e3da85b7699feb3426a0908ab98bf29df22a31b0cdd098fac2", size = 10713129, upload-time = "2025-05-01T14:53:22.27Z" }, ] +[[package]] +name = "tomli" +version = "2.2.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/18/87/302344fed471e44a87289cf4967697d07e532f2421fdaf868a303cbae4ff/tomli-2.2.1.tar.gz", hash = "sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff", size = 17175, upload-time = "2024-11-27T22:38:36.873Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/43/ca/75707e6efa2b37c77dadb324ae7d9571cb424e61ea73fad7c56c2d14527f/tomli-2.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249", size = 131077, upload-time = "2024-11-27T22:37:54.956Z" }, + { url = "https://files.pythonhosted.org/packages/c7/16/51ae563a8615d472fdbffc43a3f3d46588c264ac4f024f63f01283becfbb/tomli-2.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6", size = 123429, upload-time = "2024-11-27T22:37:56.698Z" }, + { url = "https://files.pythonhosted.org/packages/f1/dd/4f6cd1e7b160041db83c694abc78e100473c15d54620083dbd5aae7b990e/tomli-2.2.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a", size = 226067, upload-time = "2024-11-27T22:37:57.63Z" }, + { url = "https://files.pythonhosted.org/packages/a9/6b/c54ede5dc70d648cc6361eaf429304b02f2871a345bbdd51e993d6cdf550/tomli-2.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6972ca9c9cc9f0acaa56a8ca1ff51e7af152a9f87fb64623e31d5c83700080ee", size = 236030, upload-time = "2024-11-27T22:37:59.344Z" }, + { url = "https://files.pythonhosted.org/packages/1f/47/999514fa49cfaf7a92c805a86c3c43f4215621855d151b61c602abb38091/tomli-2.2.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c954d2250168d28797dd4e3ac5cf812a406cd5a92674ee4c8f123c889786aa8e", size = 240898, upload-time = "2024-11-27T22:38:00.429Z" }, + { url = "https://files.pythonhosted.org/packages/73/41/0a01279a7ae09ee1573b423318e7934674ce06eb33f50936655071d81a24/tomli-2.2.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8dd28b3e155b80f4d54beb40a441d366adcfe740969820caf156c019fb5c7ec4", size = 229894, upload-time = "2024-11-27T22:38:02.094Z" }, + { url = "https://files.pythonhosted.org/packages/55/18/5d8bc5b0a0362311ce4d18830a5d28943667599a60d20118074ea1b01bb7/tomli-2.2.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:e59e304978767a54663af13c07b3d1af22ddee3bb2fb0618ca1593e4f593a106", size = 245319, upload-time = "2024-11-27T22:38:03.206Z" }, + { url = "https://files.pythonhosted.org/packages/92/a3/7ade0576d17f3cdf5ff44d61390d4b3febb8a9fc2b480c75c47ea048c646/tomli-2.2.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:33580bccab0338d00994d7f16f4c4ec25b776af3ffaac1ed74e0b3fc95e885a8", size = 238273, upload-time = "2024-11-27T22:38:04.217Z" }, + { url = "https://files.pythonhosted.org/packages/72/6f/fa64ef058ac1446a1e51110c375339b3ec6be245af9d14c87c4a6412dd32/tomli-2.2.1-cp311-cp311-win32.whl", hash = "sha256:465af0e0875402f1d226519c9904f37254b3045fc5084697cefb9bdde1ff99ff", size = 98310, upload-time = "2024-11-27T22:38:05.908Z" }, + { url = "https://files.pythonhosted.org/packages/6a/1c/4a2dcde4a51b81be3530565e92eda625d94dafb46dbeb15069df4caffc34/tomli-2.2.1-cp311-cp311-win_amd64.whl", hash = "sha256:2d0f2fdd22b02c6d81637a3c95f8cd77f995846af7414c5c4b8d0545afa1bc4b", size = 108309, upload-time = "2024-11-27T22:38:06.812Z" }, + { url = "https://files.pythonhosted.org/packages/52/e1/f8af4c2fcde17500422858155aeb0d7e93477a0d59a98e56cbfe75070fd0/tomli-2.2.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:4a8f6e44de52d5e6c657c9fe83b562f5f4256d8ebbfe4ff922c495620a7f6cea", size = 132762, upload-time = "2024-11-27T22:38:07.731Z" }, + { url = "https://files.pythonhosted.org/packages/03/b8/152c68bb84fc00396b83e7bbddd5ec0bd3dd409db4195e2a9b3e398ad2e3/tomli-2.2.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8d57ca8095a641b8237d5b079147646153d22552f1c637fd3ba7f4b0b29167a8", size = 123453, upload-time = "2024-11-27T22:38:09.384Z" }, + { url = "https://files.pythonhosted.org/packages/c8/d6/fc9267af9166f79ac528ff7e8c55c8181ded34eb4b0e93daa767b8841573/tomli-2.2.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4e340144ad7ae1533cb897d406382b4b6fede8890a03738ff1683af800d54192", size = 233486, upload-time = "2024-11-27T22:38:10.329Z" }, + { url = "https://files.pythonhosted.org/packages/5c/51/51c3f2884d7bab89af25f678447ea7d297b53b5a3b5730a7cb2ef6069f07/tomli-2.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:db2b95f9de79181805df90bedc5a5ab4c165e6ec3fe99f970d0e302f384ad222", size = 242349, upload-time = "2024-11-27T22:38:11.443Z" }, + { url = "https://files.pythonhosted.org/packages/ab/df/bfa89627d13a5cc22402e441e8a931ef2108403db390ff3345c05253935e/tomli-2.2.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:40741994320b232529c802f8bc86da4e1aa9f413db394617b9a256ae0f9a7f77", size = 252159, upload-time = "2024-11-27T22:38:13.099Z" }, + { url = "https://files.pythonhosted.org/packages/9e/6e/fa2b916dced65763a5168c6ccb91066f7639bdc88b48adda990db10c8c0b/tomli-2.2.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:400e720fe168c0f8521520190686ef8ef033fb19fc493da09779e592861b78c6", size = 237243, upload-time = "2024-11-27T22:38:14.766Z" }, + { url = "https://files.pythonhosted.org/packages/b4/04/885d3b1f650e1153cbb93a6a9782c58a972b94ea4483ae4ac5cedd5e4a09/tomli-2.2.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:02abe224de6ae62c19f090f68da4e27b10af2b93213d36cf44e6e1c5abd19fdd", size = 259645, upload-time = "2024-11-27T22:38:15.843Z" }, + { url = "https://files.pythonhosted.org/packages/9c/de/6b432d66e986e501586da298e28ebeefd3edc2c780f3ad73d22566034239/tomli-2.2.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:b82ebccc8c8a36f2094e969560a1b836758481f3dc360ce9a3277c65f374285e", size = 244584, upload-time = "2024-11-27T22:38:17.645Z" }, + { url = "https://files.pythonhosted.org/packages/1c/9a/47c0449b98e6e7d1be6cbac02f93dd79003234ddc4aaab6ba07a9a7482e2/tomli-2.2.1-cp312-cp312-win32.whl", hash = "sha256:889f80ef92701b9dbb224e49ec87c645ce5df3fa2cc548664eb8a25e03127a98", size = 98875, upload-time = "2024-11-27T22:38:19.159Z" }, + { url = "https://files.pythonhosted.org/packages/ef/60/9b9638f081c6f1261e2688bd487625cd1e660d0a85bd469e91d8db969734/tomli-2.2.1-cp312-cp312-win_amd64.whl", hash = "sha256:7fc04e92e1d624a4a63c76474610238576942d6b8950a2d7f908a340494e67e4", size = 109418, upload-time = "2024-11-27T22:38:20.064Z" }, + { url = "https://files.pythonhosted.org/packages/04/90/2ee5f2e0362cb8a0b6499dc44f4d7d48f8fff06d28ba46e6f1eaa61a1388/tomli-2.2.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7", size = 132708, upload-time = "2024-11-27T22:38:21.659Z" }, + { url = "https://files.pythonhosted.org/packages/c0/ec/46b4108816de6b385141f082ba99e315501ccd0a2ea23db4a100dd3990ea/tomli-2.2.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:286f0ca2ffeeb5b9bd4fcc8d6c330534323ec51b2f52da063b11c502da16f30c", size = 123582, upload-time = "2024-11-27T22:38:22.693Z" }, + { url = "https://files.pythonhosted.org/packages/a0/bd/b470466d0137b37b68d24556c38a0cc819e8febe392d5b199dcd7f578365/tomli-2.2.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a92ef1a44547e894e2a17d24e7557a5e85a9e1d0048b0b5e7541f76c5032cb13", size = 232543, upload-time = "2024-11-27T22:38:24.367Z" }, + { url = "https://files.pythonhosted.org/packages/d9/e5/82e80ff3b751373f7cead2815bcbe2d51c895b3c990686741a8e56ec42ab/tomli-2.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9316dc65bed1684c9a98ee68759ceaed29d229e985297003e494aa825ebb0281", size = 241691, upload-time = "2024-11-27T22:38:26.081Z" }, + { url = "https://files.pythonhosted.org/packages/05/7e/2a110bc2713557d6a1bfb06af23dd01e7dde52b6ee7dadc589868f9abfac/tomli-2.2.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272", size = 251170, upload-time = "2024-11-27T22:38:27.921Z" }, + { url = "https://files.pythonhosted.org/packages/64/7b/22d713946efe00e0adbcdfd6d1aa119ae03fd0b60ebed51ebb3fa9f5a2e5/tomli-2.2.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:ac065718db92ca818f8d6141b5f66369833d4a80a9d74435a268c52bdfa73140", size = 236530, upload-time = "2024-11-27T22:38:29.591Z" }, + { url = "https://files.pythonhosted.org/packages/38/31/3a76f67da4b0cf37b742ca76beaf819dca0ebef26d78fc794a576e08accf/tomli-2.2.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:d920f33822747519673ee656a4b6ac33e382eca9d331c87770faa3eef562aeb2", size = 258666, upload-time = "2024-11-27T22:38:30.639Z" }, + { url = "https://files.pythonhosted.org/packages/07/10/5af1293da642aded87e8a988753945d0cf7e00a9452d3911dd3bb354c9e2/tomli-2.2.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:a198f10c4d1b1375d7687bc25294306e551bf1abfa4eace6650070a5c1ae2744", size = 243954, upload-time = "2024-11-27T22:38:31.702Z" }, + { url = "https://files.pythonhosted.org/packages/5b/b9/1ed31d167be802da0fc95020d04cd27b7d7065cc6fbefdd2f9186f60d7bd/tomli-2.2.1-cp313-cp313-win32.whl", hash = "sha256:d3f5614314d758649ab2ab3a62d4f2004c825922f9e370b29416484086b264ec", size = 98724, upload-time = "2024-11-27T22:38:32.837Z" }, + { url = "https://files.pythonhosted.org/packages/c7/32/b0963458706accd9afcfeb867c0f9175a741bf7b19cd424230714d722198/tomli-2.2.1-cp313-cp313-win_amd64.whl", hash = "sha256:a38aa0308e754b0e3c67e344754dff64999ff9b513e691d0e786265c93583c69", size = 109383, upload-time = "2024-11-27T22:38:34.455Z" }, + { url = "https://files.pythonhosted.org/packages/6e/c2/61d3e0f47e2b74ef40a68b9e6ad5984f6241a942f7cd3bbfbdbd03861ea9/tomli-2.2.1-py3-none-any.whl", hash = "sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc", size = 14257, upload-time = "2024-11-27T22:38:35.385Z" }, +] + [[package]] name = "urllib3" version = "2.4.0" @@ -154,3 +246,12 @@ sdist = { url = "https://files.pythonhosted.org/packages/8a/78/16493d9c386d8e60e wheels = [ { url = "https://files.pythonhosted.org/packages/6b/11/cc635220681e93a0183390e26485430ca2c7b5f9d33b15c74c2861cb8091/urllib3-2.4.0-py3-none-any.whl", hash = "sha256:4e16665048960a0900c702d4a66415956a584919c03361cac9f1df5c5dd7e813", size = 128680, upload-time = "2025-04-10T15:23:37.377Z" }, ] + +[[package]] +name = "zipp" +version = "3.21.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/3f/50/bad581df71744867e9468ebd0bcd6505de3b275e06f202c2cb016e3ff56f/zipp-3.21.0.tar.gz", hash = "sha256:2c9958f6430a2040341a52eb608ed6dd93ef4392e02ffe219417c1b28b5dd1f4", size = 24545, upload-time = "2024-11-10T15:05:20.202Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b7/1a/7e4798e9339adc931158c9d69ecc34f5e6791489d469f5e50ec15e35f458/zipp-3.21.0-py3-none-any.whl", hash = "sha256:ac1bbe05fd2991f160ebce24ffbac5f6d11d83dc90891255885223d42b3cd931", size = 9630, upload-time = "2024-11-10T15:05:19.275Z" }, +] From be5b7ebfbe56bab908bbfa4c8afb118c0a07d805 Mon Sep 17 00:00:00 2001 From: Dev Bear Date: Thu, 8 May 2025 12:37:49 -0400 Subject: [PATCH 2/8] more cleanup --- src/examples/basic.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/examples/basic.py b/src/examples/basic.py index 14ccad7..d36b7d0 100644 --- a/src/examples/basic.py +++ b/src/examples/basic.py @@ -3,23 +3,23 @@ import requests -from furthermore_py import Client +from furthermore_py import FurthermoreClient # Basic Example - Run this script directly to test the collector if __name__ == "__main__": - print("Attempting to use FurthermoreCo lector (Example Usage)...") + print("Attempting to use FurthermoreCollector (Example Usage)...") - api_key_present = os.getenv(Client.FURTHERMORE_API_KEY_ENV_VAR) + api_key_present = os.getenv(FurthermoreClient.FURTHERMORE_API_KEY_ENV_VAR) if not api_key_present: print( - f"CRITICAL: The environment variable '{Client.FURTHERMORE_API_KEY_ENV_VAR}' is not set." + f"CRITICAL: The environment variable '{FurthermoreClient.FURTHERMORE_API_KEY_ENV_VAR}' is not set." ) print( - "Please set it before running this example (e.g., export {Client.FURTHERMORE_API_KEY_ENV_VAR}=your_key)." + "Please set it before running this example (e.g., export {FurthermoreClient.FURTHERMORE_API_KEY_ENV_VAR}=your_key)." ) else: print( - f"Environment variable '{Client.FURTHERMORE_API_KEY_ENV_VAR}' is set." + f"Environment variable '{FurthermoreClient.FURTHERMORE_API_KEY_ENV_VAR}' is set." ) example_logger = logging.getLogger("ClientExample") example_logger.setLevel(logging.INFO) @@ -31,7 +31,7 @@ ch.setFormatter(formatter) example_logger.addHandler(ch) example_logger.propagate = False - client = Client(logger=example_logger) + client = FurthermoreClient(logger=example_logger) try: print("\nFetching articles (first 3 vaults):") From 5013a56120ff7b02803d00bbe0f7da8e07c3e107 Mon Sep 17 00:00:00 2001 From: Dev Bear Date: Thu, 8 May 2025 12:38:11 -0400 Subject: [PATCH 3/8] bet --- README.md | 36 ++++++++++++++++++++---------------- src/furthermore_py/client.py | 6 ++---- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index f27b339..123f9f7 100644 --- a/README.md +++ b/README.md @@ -32,14 +32,15 @@ This client provides methods to interact with the Furthermore API endpoints for # .venv\Scripts\activate # On Windows ``` -3. **Install dependencies:** - With `requests` now listed in your `pyproject.toml`, you can install all project dependencies (including `requests` and the project itself in editable mode if desired) using: +3. **Install dependencies and the project for development:** + To install dependencies and make your project importable (recommended for development, especially for running examples): ```bash - uv pip install . + uv pip install -e . ``` - Alternatively, to synchronize your environment with the `pyproject.toml` (recommended after pulling changes or modifying dependencies): + This installs the project in "editable" mode. If you only want to install dependencies as defined (e.g., for a non-development setup or CI), you can use: ```bash uv sync + # or uv pip install . ``` 4. **Set the API Key:** @@ -47,27 +48,27 @@ This client provides methods to interact with the Furthermore API endpoints for ```bash export FURTHERMORE_API_KEY="your_actual_api_key_here" ``` - Alternatively, you can pass the `api_key` directly when initializing the `Client`. + Alternatively, you can pass the `api_key` directly when initializing the `FurthermoreClient`. ## Usage -Here's a basic example of how to use the `Client`: +Here's a basic example of how to use the `FurthermoreClient`: ```python import os import logging -from furthermore_py import Client # Adjust import based on your project structure +from furthermore_py import FurthermoreClient # Adjust import based on your project structure if __name__ == '__main__': # Ensure API key is set - api_key = os.getenv(Client.FURTHERMORE_API_KEY_ENV_VAR) + api_key = os.getenv(FurthermoreClient.FURTHERMORE_API_KEY_ENV_VAR) if not api_key: - print(f"CRITICAL: The environment variable '{Client.FURTHERMORE_API_KEY_ENV_VAR}' is not set.") - print(f"Please set it before running this example (e.g., export {Client.FURTHERMORE_API_KEY_ENV_VAR}=your_key).") + print(f"CRITICAL: The environment variable '{FurthermoreClient.FURTHERMORE_API_KEY_ENV_VAR}' is not set.") + print(f"Please set it before running this example (e.g., export {FurthermoreClient.FURTHERMORE_API_KEY_ENV_VAR}=your_key).") exit() # Optional: Configure logging for the example - example_logger = logging.getLogger("ClientExample") + example_logger = logging.getLogger("FurthermoreClientExample") example_logger.setLevel(logging.INFO) if not example_logger.hasHandlers(): ch = logging.StreamHandler() @@ -76,7 +77,7 @@ if __name__ == '__main__': example_logger.addHandler(ch) example_logger.propagate = False # Avoid duplicate logs if root logger is configured - client = Client(logger=example_logger) + client = FurthermoreClient(logger=example_logger) try: print("\nFetching articles (first 3 vaults):") @@ -111,11 +112,14 @@ if __name__ == '__main__': ### How to Run the Example Script -To run the example script (e.g., if it's `src/examples/basic.py`), ensure your virtual environment is activated and you are in the project root directory: +To run the example script (e.g., `src/examples/basic.py`): -```bash -python src/examples/basic.py -``` +1. Ensure your virtual environment is activated (`source .venv/bin/activate`). +2. Make sure the package is installed in editable mode from the project root directory: `uv pip install -e .` +3. Run the script from the project root directory: + ```bash + python src/examples/basic.py + ``` ## API Documentation diff --git a/src/furthermore_py/client.py b/src/furthermore_py/client.py index 6410342..bfd9b2a 100644 --- a/src/furthermore_py/client.py +++ b/src/furthermore_py/client.py @@ -63,9 +63,7 @@ def __init__( "Authorization": f"Bearer {self.api_key}", "Content-Type": "application/json", } - self.logger.info( - f"Client initialized with base URL: {self.base_url}" - ) + self.logger.info(f"Client initialized with base URL: {self.base_url}") def _make_request( self, @@ -210,7 +208,7 @@ def get_sources(self, vault_limit_for_scan: int = 100) -> dict[str, set[str]]: if p_name_nested := protocol_obj.get("name"): if isinstance(p_name_nested, str) and p_name_nested.strip(): protocols.add(p_name_nested.strip()) - + # Extract from metadata.incentivizer.name if incentivizer_obj := metadata.get("incentivizer"): if isinstance(incentivizer_obj, dict): From a02e1f1d980d57503f4451c0916c102b6d4c959a Mon Sep 17 00:00:00 2001 From: Dev Bear Date: Thu, 8 May 2025 12:38:57 -0400 Subject: [PATCH 4/8] bet --- src/furthermore_py/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/furthermore_py/client.py b/src/furthermore_py/client.py index bfd9b2a..99ee163 100644 --- a/src/furthermore_py/client.py +++ b/src/furthermore_py/client.py @@ -37,7 +37,7 @@ def __init__( logger: logging.Logger | None = None, ): """ - Initializes the Client. + Initializes the FurthermoreClient. Args: base_url: The base URL for the Furthermore API. @@ -63,7 +63,7 @@ def __init__( "Authorization": f"Bearer {self.api_key}", "Content-Type": "application/json", } - self.logger.info(f"Client initialized with base URL: {self.base_url}") + self.logger.info(f"FurthermoreClient initialized with base URL: {self.base_url}") def _make_request( self, From daef2e7d6f7e5507056f83e409506cca805d1efa Mon Sep 17 00:00:00 2001 From: Dev Bear Date: Thu, 8 May 2025 12:40:01 -0400 Subject: [PATCH 5/8] bet --- src/furthermore_py/client.py | 52 +++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/src/furthermore_py/client.py b/src/furthermore_py/client.py index 99ee163..e1ca934 100644 --- a/src/furthermore_py/client.py +++ b/src/furthermore_py/client.py @@ -120,6 +120,33 @@ def _make_request( ) raise + def _extract_and_add_name( + self, data: dict | None, path: tuple[str, ...], target_set: set[str] + ): + """ + Safely extracts a name from a nested dictionary path and adds it to the target set + if the name is a non-empty string. + + Args: + data: The dictionary to extract from (e.g., metadata). + path: A tuple of keys representing the path to the name. + target_set: The set to add the validated name to. + """ + if not isinstance(data, dict): + return + + current_level = data + for key in path[:-1]: # Traverse to the parent of the target name + current_level = current_level.get(key) + if not isinstance(current_level, dict): + return # Path broken or not a dict, cannot continue + + name_value = current_level.get(path[-1]) + if isinstance(name_value, str): + stripped_name = name_value.strip() + if stripped_name: # Ensure it's not an empty string after stripping + target_set.add(stripped_name) + def get_vaults( self, offset: int = 0, @@ -189,32 +216,13 @@ def get_sources(self, vault_limit_for_scan: int = 100) -> dict[str, set[str]]: protocols: set[str] = set() incentivizers: set[str] = set() try: - # Corrected method call from get_articles to get_vaults vault_data = self.get_vaults(limit=vault_limit_for_scan) for vault in vault_data.get("vaults", []): metadata = vault.get("metadata") - if not isinstance(metadata, dict): - continue # Skip if metadata is not a dictionary or missing - - # Extract from metadata.protocolName - if p_name_direct := metadata.get("protocolName"): - if isinstance(p_name_direct, str) and p_name_direct.strip(): - protocols.add(p_name_direct.strip()) - - # Extract from metadata.protocol.name - if protocol_obj := metadata.get("protocol"): - if isinstance(protocol_obj, dict): - if p_name_nested := protocol_obj.get("name"): - if isinstance(p_name_nested, str) and p_name_nested.strip(): - protocols.add(p_name_nested.strip()) - - # Extract from metadata.incentivizer.name - if incentivizer_obj := metadata.get("incentivizer"): - if isinstance(incentivizer_obj, dict): - if i_name := incentivizer_obj.get("name"): - if isinstance(i_name, str) and i_name.strip(): - incentivizers.add(i_name.strip()) + self._extract_and_add_name(metadata, ("protocolName",), protocols) + self._extract_and_add_name(metadata, ("protocol", "name"), protocols) + self._extract_and_add_name(metadata, ("incentivizer", "name"), incentivizers) self.logger.info( f"Found {len(protocols)} unique protocols and {len(incentivizers)} unique incentivizers." From 736d26cfebe461f318b68cd760585a9b28157f60 Mon Sep 17 00:00:00 2001 From: Dev Bear Date: Thu, 8 May 2025 12:40:52 -0400 Subject: [PATCH 6/8] bet --- src/furthermore_py/client.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/furthermore_py/client.py b/src/furthermore_py/client.py index e1ca934..126c3fc 100644 --- a/src/furthermore_py/client.py +++ b/src/furthermore_py/client.py @@ -136,15 +136,15 @@ def _extract_and_add_name( return current_level = data - for key in path[:-1]: # Traverse to the parent of the target name + for key in path[:-1]: current_level = current_level.get(key) if not isinstance(current_level, dict): - return # Path broken or not a dict, cannot continue + return name_value = current_level.get(path[-1]) if isinstance(name_value, str): stripped_name = name_value.strip() - if stripped_name: # Ensure it's not an empty string after stripping + if stripped_name: target_set.add(stripped_name) def get_vaults( From e5d899777a4329f40b574d966cf95455c4e45828 Mon Sep 17 00:00:00 2001 From: Dev Bear Date: Thu, 8 May 2025 12:42:20 -0400 Subject: [PATCH 7/8] run linter --- src/furthermore_py/client.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/furthermore_py/client.py b/src/furthermore_py/client.py index 126c3fc..f80fe49 100644 --- a/src/furthermore_py/client.py +++ b/src/furthermore_py/client.py @@ -63,7 +63,9 @@ def __init__( "Authorization": f"Bearer {self.api_key}", "Content-Type": "application/json", } - self.logger.info(f"FurthermoreClient initialized with base URL: {self.base_url}") + self.logger.info( + f"FurthermoreClient initialized with base URL: {self.base_url}" + ) def _make_request( self, @@ -139,12 +141,12 @@ def _extract_and_add_name( for key in path[:-1]: current_level = current_level.get(key) if not isinstance(current_level, dict): - return + return name_value = current_level.get(path[-1]) if isinstance(name_value, str): stripped_name = name_value.strip() - if stripped_name: + if stripped_name: target_set.add(stripped_name) def get_vaults( @@ -222,7 +224,9 @@ def get_sources(self, vault_limit_for_scan: int = 100) -> dict[str, set[str]]: metadata = vault.get("metadata") self._extract_and_add_name(metadata, ("protocolName",), protocols) self._extract_and_add_name(metadata, ("protocol", "name"), protocols) - self._extract_and_add_name(metadata, ("incentivizer", "name"), incentivizers) + self._extract_and_add_name( + metadata, ("incentivizer", "name"), incentivizers + ) self.logger.info( f"Found {len(protocols)} unique protocols and {len(incentivizers)} unique incentivizers." From 71d859177e71eb02191b17be890dfff9f67e8473 Mon Sep 17 00:00:00 2001 From: Dev Bear Date: Thu, 8 May 2025 12:42:57 -0400 Subject: [PATCH 8/8] buimp version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 66d2710..11eba1c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "furthermore-py" -version = "0.1.2" +version = "0.1.3" description = "Add your description here" readme = "README.md" requires-python = ">=3.10"