Skip to content

Commit 6ad1b20

Browse files
committed
Making user-agent consistent with pyvo
1 parent 3229fa7 commit 6ad1b20

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

astroquery/mast/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ def _simple_request(url, params):
7676
"""
7777

7878
session = requests.session()
79-
old_user_agent = session.headers['User-Agent']
80-
headers = {"User-Agent": f"astroquery/{version} ({platform.system()} {platform.python_version()}) {old_user_agent}",
79+
headers = {"User-Agent": (f"astroquery/{version} Python/{platform.python_version()} ({platform.system()}) "
80+
f"{session.headers['User-Agent']}"),
8181
"Content-type": "application/x-www-form-urlencoded",
8282
"Accept": "text/plain"}
8383

astroquery/query.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ def __init__(self):
185185
S = self._session = requests.Session()
186186
self._session.hooks['response'].append(self._response_hook)
187187
S.headers['User-Agent'] = (
188-
f"astroquery/{version.version} ({platform.system()} {platform.python_version()}) {S.headers['User-Agent']}")
188+
f"astroquery/{version.version} Python/{platform.python_version()} ({platform.system()}) "
189+
f"{S.headers['User-Agent']}")
189190

190191
self.name = self.__class__.__name__.split("Class")[0]
191192
self._cache_location = None

astroquery/utils/tap/conn/tapconn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def __interna_init(self):
119119
self.__postHeaders = {
120120
"Content-type": CONTENT_TYPE_POST_DEFAULT,
121121
"Accept": "text/plain",
122-
"User-Agent": "astroquery/{vers} ({plat} {sysver})".format(
122+
"User-Agent": "astroquery/{vers} Python/{sysver} ({plat})".format(
123123
vers=version.version, plat=platform.system(), sysver=platform.python_version()),
124124
}
125125
self.__getHeaders = {}

0 commit comments

Comments
 (0)