From 0f0211fb2c90d6d3a34cb51ceeb8d3805be29fa2 Mon Sep 17 00:00:00 2001
From: "duncan.macleod" <duncan.macleod@ligo.org>
Date: Mon, 9 May 2022 14:47:18 +0100
Subject: [PATCH] gwdatafind.http: fix bugs in old HTTP API

---
 gwdatafind/http.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gwdatafind/http.py b/gwdatafind/http.py
index c58efe2..39bddf3 100644
--- a/gwdatafind/http.py
+++ b/gwdatafind/http.py
@@ -91,6 +91,8 @@ class HTTPConnection(http_client.HTTPConnection):
         RuntimeError
             if query is unsuccessful
         """
+        if not url.startswith("/"):  # ensure all URLs start with a slash
+            url = f"/{url}"
         self.request(method, url, **kwargs)
         response = self.getresponse()
         if response.status != 200:
@@ -272,8 +274,8 @@ class HTTPConnection(http_client.HTTPConnection):
         path = api.find_times_path(
             site,
             frametype,
-            gpsstart or 1,
-            gpsend or 2e9,
+            gpsstart or int(1),
+            gpsend or int(2e9),
         )
         segmentlist = self.get_json(path)
         return segments.segmentlist(map(segments.segment, segmentlist))
-- 
GitLab