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 dbf9fe5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
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 dbf9fe5

Please sign in to comment.