Skip to content

Commit

Permalink
Update user-agent value passed by the library
Browse files Browse the repository at this point in the history
This fixes #38.
  • Loading branch information
lpellegr committed Jun 13, 2024
1 parent 0092942 commit f274f50
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 0 additions & 2 deletions ipregistry/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
name = "ipregistry"

from .version import __version__

from .cache import *
from .core import *
from .json import *
Expand Down
11 changes: 9 additions & 2 deletions ipregistry/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
"""

import importlib
import json
import sys
import urllib.parse
Expand Down Expand Up @@ -248,8 +248,15 @@ def __create_api_error(response):
raise ClientError("HTTP Error occurred, but no response was received.")

def __headers(self):
python_version = sys.version.split()[0]
lib_version = importlib.metadata.version('ipregistry')
return {
"authorization": "ApiKey " + self._config.api_key,
"content-type": "application/json",
"user-agent": "Ipregistry/Python" + str(sys.version_info[0]) + "/" + __version__
"user-agent":
"Ipregistry/" +
lib_version +
" (Library; Python/" +
python_version +
"; +https://github.com/ipregistry/ipregistry-python)"
}
1 change: 0 additions & 1 deletion ipregistry/version.py

This file was deleted.

0 comments on commit f274f50

Please sign in to comment.