Skip to content

Commit

Permalink
fix another http encoding error (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
funbaker authored Oct 20, 2016
1 parent 2c5024f commit 81521c3
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion pyvo/dal/tap.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ def availability(self):
if self._availability == (None, None):
r = requests.get(
'{0}/availability'.format(self.baseurl), stream = True)

# requests doesn't decode the content by default
r.raw.read = functools.partial(r.raw.read, decode_content=True)

self._availability = vosi.parse_availability(r.raw)
return self._availability

Expand Down Expand Up @@ -136,6 +140,10 @@ def capabilities(self):
if self._capabilities is None:
r = requests.get(
'{0}/capabilities'.format(self.baseurl), stream = True)

# requests doesn't decode the content by default
r.raw.read = functools.partial(r.raw.read, decode_content=True)

self._capabilities = vosi.parse_capabilities(r.raw)
return self._capabilities

Expand All @@ -146,6 +154,10 @@ def tables(self):
"""
if self._tables is None:
r = requests.get('{0}/tables'.format(self.baseurl), stream = True)

# requests doesn't decode the content by default
r.raw.read = functools.partial(r.raw.read, decode_content=True)

self._tables = vosi.parse_tables(r.raw)
return self._tables

Expand Down Expand Up @@ -403,6 +415,7 @@ def submit(self):

r = requests.post(url, data = self._param, stream = True,
files = files)
# requests doesn't decode the content by default
r.raw.read = functools.partial(r.raw.read, decode_content=True)
return r

Expand Down Expand Up @@ -457,8 +470,11 @@ def _update(self):
r.raise_for_status()
except requests.exceptions.RequestException as ex:
raise DALServiceError.from_except(ex, self.url, "TAP", "1.0")

# requests doesn't decode the content by default
r.raw.read = functools.partial(r.raw.read, decode_content=True)

self._job.update(uws.parse_job(r.raw))
pass

@property
def job(self):
Expand Down

0 comments on commit 81521c3

Please sign in to comment.