Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update base.py to remove setuptools and use standard library #694

Merged
merged 3 commits into from
Jul 1, 2024
Merged
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
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions polygon/rest/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
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
from urllib.parse import urlencode
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


Expand Down Expand Up @@ -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
Expand Down
Loading