Skip to content

Commit ac827c9

Browse files
committed
Merge pull request #490 from keflavich/user-agent
HTTP user-agent should be astroquery
2 parents 615fc10 + 1447758 commit ac827c9

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

astroquery/query.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
from astropy.utils.console import ProgressBar
1515
import astropy.utils.data
1616

17+
from . import version
18+
1719
__all__ = ['BaseQuery', 'QueryWithLogin']
1820

1921

@@ -96,7 +98,10 @@ class BaseQuery(object):
9698
"""
9799

98100
def __init__(self):
99-
self._session = requests.session()
101+
S = self._session = requests.session()
102+
S.headers['User-Agent'] = ('astroquery/{vers} {olduseragent}'
103+
.format(vers=version.version,
104+
olduseragent=S.headers['User-Agent']))
100105
self.cache_location = os.path.join(paths.get_cache_dir(), 'astroquery',
101106
self.__class__.__name__.split("Class")[0])
102107
if not os.path.exists(self.cache_location):

astroquery/simbad/core.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ class SimbadClass(BaseQuery):
115115
_VOTABLE_FIELDS = ['main_id', 'coordinates']
116116

117117
def __init__(self):
118+
super(SimbadClass, self).__init__()
118119
self._VOTABLE_FIELDS = copy.copy(self._VOTABLE_FIELDS)
119120

120121
def list_wildcards(self):

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def __getattr__(cls, name):
181181
else:
182182
return Mock()
183183

184-
MOCK_MODULES = ['atpy', 'beautifulsoup4', 'vo', 'requests', 'lxml', 'keyring', 'bs4']
184+
MOCK_MODULES = ['atpy', 'beautifulsoup4', 'vo', 'lxml', 'keyring', 'bs4']
185185
for mod_name in MOCK_MODULES:
186186
sys.modules[mod_name] = Mock()
187187

0 commit comments

Comments
 (0)