diff --git a/CHANGES.md b/CHANGES.md index 55e9abd1..079de2a9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,10 @@ +# 1.2.6 + +- [FIXED] ComplianceFetcher.session can now be reset. + # 1.2.5 -- [FIXED] Credentials section bug affecting the Slack notifier. +- [FIXED] Credentials section bug affecting the Slack notifier is squashed. # 1.2.4 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d4040b49..412a6772 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,7 +14,7 @@ There are some guidelines to follow when making a common fetcher or check: - The sub-document structure to adhere to for a common module is one where the root of the sub-document is the org. Under the org there should be a name field which would refer to the organization’s name. Each common module configuration sub-document should also be under the org sub-document. For example: -```json +``` { ... "org": { diff --git a/compliance/__init__.py b/compliance/__init__.py index f029117e..efd7bc20 100644 --- a/compliance/__init__.py +++ b/compliance/__init__.py @@ -14,4 +14,4 @@ # limitations under the License. """Compliance automation package.""" -__version__ = '1.2.5' +__version__ = '1.2.6' diff --git a/compliance/fetch.py b/compliance/fetch.py index afa8c9e8..8b27342f 100644 --- a/compliance/fetch.py +++ b/compliance/fetch.py @@ -35,12 +35,17 @@ def session(cls, url=None, creds=None, **headers): """ Provide a requests session object with User-Agent header. - :param url: optional base URL for the session requests to use. + :param url: optional base URL for the session requests to use. A url + argument triggers a new session object to be created whereas no url + argument will return the current session object if one exists. :param creds: optional authentication credentials. :param headers: optional kwargs to add to session headers. :returns: a requests Session object. """ + if url is not None and hasattr(cls, '_session'): + cls._session.close() + delattr(cls, '_session') if not hasattr(cls, '_session'): if url: cls._session = BaseSession(url)