diff --git a/README.md b/README.md index 3df6c512..aaf7bb5f 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,7 @@ Welcome to the official Python client library for the [Polygon](https://polygon. ## Prerequisites -Before installing the Polygon Python client, ensure your environment has Python 3.8 or higher. While most Python environments come with setuptools installed, it is a dependency for this library. In the rare case it's not already present, you can install setuptools using pip: - -``` -pip install setuptools -``` +Before installing the Polygon Python client, ensure your environment has Python 3.8 or higher. ## Install diff --git a/polygon/rest/base.py b/polygon/rest/base.py index 3e65c06c..3a5d637f 100644 --- a/polygon/rest/base.py +++ b/polygon/rest/base.py @@ -7,7 +7,7 @@ from enum import Enum from typing import Optional, Any, Dict from datetime import datetime -import pkg_resources # part of setuptools +from importlib.metadata import version, PackageNotFoundError from .models.request import RequestOptionBuilder from ..logging import get_logger import logging @@ -15,10 +15,10 @@ from ..exceptions import AuthError, BadResponse logger = get_logger("RESTClient") -version = "unknown" +version_number = "unknown" try: - version = pkg_resources.require("polygon-api-client")[0].version -except: + version_number = version("polygon-api-client") +except PackageNotFoundError: pass @@ -46,7 +46,7 @@ def __init__( self.headers = { "Authorization": "Bearer " + self.API_KEY, "Accept-Encoding": "gzip", - "User-Agent": f"Polygon.io PythonClient/{version}", + "User-Agent": f"Polygon.io PythonClient/{version_number}", } # initialize self.retries with the parameter value before using it