Skip to content

Commit 7c5c713

Browse files
authored
Merge pull request #10 from aaronweeden/user-agent
Add `User-Agent` header identifying the package.
2 parents 0e1e57f + fb84682 commit 7c5c713

File tree

5 files changed

+16
-7
lines changed

5 files changed

+16
-7
lines changed

.github/workflows/python-package.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ jobs:
3333
- name: Lint with flake8
3434
run: |
3535
# stop the build if there are linter errors (ignore complexity metrics)
36-
flake8 . --count --max-line-length=127 --max-complexity=1000 --show-source --statistics
36+
flake8 . --count --max-line-length=127 --max-complexity=1000 --show-source --statistics --exclude __init__.py
3737
# output complexity metrics
38-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
38+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude __init__.py
3939
- name: Test with pytest
4040
run: |
4141
pytest tests/unit

setup.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
from setuptools import setup, find_packages
2+
from xdmod.__version__ import __title__, __version__, __description__
3+
24
setup(
3-
name="xdmod",
4-
version="0.0.15",
5-
description='Python driver for XDMoD',
5+
name=__title__,
6+
version=__version__,
7+
description=__description__,
68
license='LGPLv3',
79
author='Joseph P White',
810
author_email='jpwhite4@buffalo.edu',

xdmod/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
""" Driver module for XDMoD """
1+
from .__version__ import __version__

xdmod/__version__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
__title__ = 'xdmod'
2+
__version__ = '1.0.0-alpha.1'
3+
__description__ = 'Python driver for XDMoD'

xdmod/_http_requester.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import requests
44
from urllib.parse import urlencode
55
import xdmod._validator as _validator
6+
from xdmod.__version__ import __title__, __version__
67

78

89
class _HttpRequester:
@@ -16,7 +17,10 @@ def __init__(self, xdmod_host):
1617
raise KeyError(
1718
'`XDMOD_API_TOKEN` environment variable has not been set.'
1819
) from None
19-
self.__headers = {'Authorization': 'Bearer ' + self.__api_token}
20+
self.__headers = {
21+
'Authorization': 'Bearer ' + self.__api_token,
22+
'User-Agent': __title__ + ' Python v' + __version__,
23+
}
2024
self.__requests_session = None
2125
self.__raw_data_limit = None
2226

0 commit comments

Comments
 (0)