Skip to content

Commit dbf9fe5

Browse files
Update user-agent value passed by the library
This fixes #38.
1 parent 0092942 commit dbf9fe5

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

ipregistry/request.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
"""
16-
16+
import importlib
1717
import json
1818
import sys
1919
import urllib.parse
@@ -248,8 +248,15 @@ def __create_api_error(response):
248248
raise ClientError("HTTP Error occurred, but no response was received.")
249249

250250
def __headers(self):
251+
python_version = sys.version.split()[0]
252+
lib_version = importlib.metadata.version('ipregistry')
251253
return {
252254
"authorization": "ApiKey " + self._config.api_key,
253255
"content-type": "application/json",
254-
"user-agent": "Ipregistry/Python" + str(sys.version_info[0]) + "/" + __version__
256+
"user-agent":
257+
"Ipregistry/" +
258+
lib_version +
259+
" (Library; Python/" +
260+
python_version +
261+
"; +https://github.com/ipregistry/ipregistry-python)"
255262
}

ipregistry/version.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)