Skip to content

Commit fe6d9f4

Browse files
committed
Handle lower case http location header name
1 parent 93f04ac commit fe6d9f4

File tree

1 file changed

+18
-3
lines changed
  • src/main/python/opal

1 file changed

+18
-3
lines changed

src/main/python/opal/io.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,12 @@ def table_fullname(t):
100100
response = request.post().resource(uri).content(json.dumps(options)).send()
101101

102102
# get job status
103-
job_resource = re.sub(r'http.*\/ws', r'', response.headers['Location'])
103+
location = None
104+
if 'Location' in response.headers:
105+
location = response.headers['Location']
106+
elif 'location' in response.headers:
107+
location = response.headers['location']
108+
job_resource = re.sub(r'http.*\/ws', r'', location)
104109
request = self.client.new_request()
105110
request.fail_on_error().accept_json()
106111
return request.get().resource(job_resource).send()
@@ -245,7 +250,12 @@ def table_fullname(t): return self.datasource + '.' + t
245250
response = request.post().resource(uri).content(json.dumps(options)).send()
246251

247252
# get job status
248-
job_resource = re.sub(r'http.*\/ws', r'', response.headers['Location'])
253+
location = None
254+
if 'Location' in response.headers:
255+
location = response.headers['Location']
256+
elif 'location' in response.headers:
257+
location = response.headers['location']
258+
job_resource = re.sub(r'http.*\/ws', r'', location)
249259
request = self.client.new_request()
250260
request.fail_on_error().accept_json()
251261
return request.get().resource(job_resource).send()
@@ -308,7 +318,12 @@ def table_fullname(t): return self.datasource + '.' + t
308318
response = request.post().resource(uri).content(json.dumps(options)).send()
309319

310320
# get job status
311-
job_resource = re.sub(r'http.*\/ws', r'', response.headers['Location'])
321+
location = None
322+
if 'Location' in response.headers:
323+
location = response.headers['Location']
324+
elif 'location' in response.headers:
325+
location = response.headers['location']
326+
job_resource = re.sub(r'http.*\/ws', r'', location)
312327
request = self.client.new_request()
313328
request.fail_on_error().accept_json()
314329
return request.get().resource(job_resource).send()

0 commit comments

Comments
 (0)