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

Add user agent string to outgoing requests #58

Merged
merged 1 commit into from
Oct 28, 2023
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
1 change: 1 addition & 0 deletions astrapy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
__version__ = "0.5.0"
6 changes: 5 additions & 1 deletion astrapy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging
import re

from astrapy import __version__
from astrapy.defaults import DEFAULT_TIMEOUT

logger = logging.getLogger(__name__)
Expand All @@ -15,6 +16,9 @@ class http_methods:
DELETE = "DELETE"


package_name = __name__.split(".")[0]


def make_request(
base_url,
auth_header,
Expand All @@ -31,7 +35,7 @@ def make_request(
params=url_params,
json=json_data,
timeout=DEFAULT_TIMEOUT,
headers={auth_header: token},
headers={auth_header: token, "User-Agent": f"{package_name}/{__version__}"},
)

return r
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
from setuptools import setup
from os import path

from astrapy import __version__

this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, "README.md"), encoding="utf-8") as f:
long_description = f.read()
Expand All @@ -25,7 +27,7 @@
"astrapy",
"astrapy/endpoints",
],
version="0.5.0",
version=__version__,
license="Apache license 2.0",
description="AstraPy is a Pythonic SDK for DataStax Astra",
long_description=long_description,
Expand Down
Loading