diff options
Diffstat (limited to 'cdsapi/api.py')
-rw-r--r-- | cdsapi/api.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/cdsapi/api.py b/cdsapi/api.py index 68befdb..0211856 100644 --- a/cdsapi/api.py +++ b/cdsapi/api.py @@ -14,6 +14,7 @@ import os import time import uuid +import pkg_resources import requests try: @@ -324,6 +325,11 @@ class Client(object): self.session = session self.session.auth = tuple(self.key.split(":", 2)) + self.session.headers = { + "User-Agent": "cdsapi/%s" + % pkg_resources.get_distribution("cdsapi").version, + } + assert len(self.session.auth) == 2, ( "The cdsapi key provided is not the correct format, please ensure it conforms to:\n" "<UID>:<APIKEY>" |