From 6dfa5065a0ed0598c278c0b602b626ba274cf9bd Mon Sep 17 00:00:00 2001 From: Tom Kralidis Date: Thu, 6 Jun 2024 13:40:46 -0400 Subject: [PATCH] OGC API: capture response headers (#931) --- owslib/ogcapi/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/owslib/ogcapi/__init__.py b/owslib/ogcapi/__init__.py index ad1d29f6..4e77fc7b 100644 --- a/owslib/ogcapi/__init__.py +++ b/owslib/ogcapi/__init__.py @@ -1,5 +1,5 @@ # ============================================================================= -# Copyright (c) 2022 Tom Kralidis +# Copyright (c) 2024 Tom Kralidis # # Author: Tom Kralidis # @@ -55,6 +55,8 @@ def __init__(self, url: str, json_: str = None, timeout: int = 30, self.json_ = json_ self.timeout = timeout self.headers = REQUEST_HEADERS + self.response_headers = None + if headers: self.headers.update(headers) self.auth = auth @@ -188,6 +190,7 @@ def _request(self, method: str = 'GET', path: str = None, raise RuntimeError(response.text) self.request = response.url + self.response_headers = response.headers if as_dict: if len(response.content) == 0: