Skip to content
Snippets Groups Projects
Commit 4d109a54 authored by Duncan Macleod's avatar Duncan Macleod
Browse files

Merge branch 'fix-http-api' into 'main'

Fix bugs in old HTTP API

Closes #19

See merge request computing/gwdatafind/client!72
parents cddb699b 0f0211fb
No related branches found
No related tags found
No related merge requests found
...@@ -91,6 +91,8 @@ class HTTPConnection(http_client.HTTPConnection): ...@@ -91,6 +91,8 @@ class HTTPConnection(http_client.HTTPConnection):
RuntimeError RuntimeError
if query is unsuccessful if query is unsuccessful
""" """
if not url.startswith("/"): # ensure all URLs start with a slash
url = f"/{url}"
self.request(method, url, **kwargs) self.request(method, url, **kwargs)
response = self.getresponse() response = self.getresponse()
if response.status != 200: if response.status != 200:
...@@ -272,8 +274,8 @@ class HTTPConnection(http_client.HTTPConnection): ...@@ -272,8 +274,8 @@ class HTTPConnection(http_client.HTTPConnection):
path = api.find_times_path( path = api.find_times_path(
site, site,
frametype, frametype,
gpsstart or 1, gpsstart or int(1),
gpsend or 2e9, gpsend or int(2e9),
) )
segmentlist = self.get_json(path) segmentlist = self.get_json(path)
return segments.segmentlist(map(segments.segment, segmentlist)) return segments.segmentlist(map(segments.segment, segmentlist))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment