diff --git a/theguardian/theguardian_content.py b/theguardian/theguardian_content.py index b60a842..18a0e7c 100644 --- a/theguardian/theguardian_content.py +++ b/theguardian/theguardian_content.py @@ -16,6 +16,7 @@ def __init__(self, api, url=None, **kwargs): :return: None """ + self.session = requests.Session() self.__headers = { "api-key": api, "format": "json" @@ -43,7 +44,7 @@ def __response(self, headers=None): else: headers.update(self.__headers) - res = requests.get(self.base_url, headers) + res = self.session.get(self.base_url, headers=headers) return res diff --git a/theguardian/theguardian_section.py b/theguardian/theguardian_section.py index 2ad7e62..5026d43 100644 --- a/theguardian/theguardian_section.py +++ b/theguardian/theguardian_section.py @@ -15,6 +15,7 @@ def __init__(self, api, url=None, **kwargs): :return: """ + self.session = requests.Session() self.__request_response = None self.__headers = { "api-key": api, @@ -41,7 +42,7 @@ def __response(self, header=None): header = self.__headers else: header.update(self.__headers) - res = requests.get(self.base_url, header) + res = self.session.get(self.base_url, headers=header) return res