Skip to content

Commit 6f05b77

Browse files
authored
ComplianceFetcher.session is resettable (#57)
1 parent 8ccbcc5 commit 6f05b77

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

CHANGES.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
# 1.2.6
2+
3+
- [FIXED] ComplianceFetcher.session can now be reset.
4+
15
# 1.2.5
26

3-
- [FIXED] Credentials section bug affecting the Slack notifier.
7+
- [FIXED] Credentials section bug affecting the Slack notifier is squashed.
48

59
# 1.2.4
610

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ There are some guidelines to follow when making a common fetcher or check:
1414

1515
- 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:
1616

17-
```json
17+
```
1818
{
1919
...
2020
"org": {

compliance/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
# limitations under the License.
1515
"""Compliance automation package."""
1616

17-
__version__ = '1.2.5'
17+
__version__ = '1.2.6'

compliance/fetch.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,17 @@ def session(cls, url=None, creds=None, **headers):
3535
"""
3636
Provide a requests session object with User-Agent header.
3737
38-
:param url: optional base URL for the session requests to use.
38+
:param url: optional base URL for the session requests to use. A url
39+
argument triggers a new session object to be created whereas no url
40+
argument will return the current session object if one exists.
3941
:param creds: optional authentication credentials.
4042
:param headers: optional kwargs to add to session headers.
4143
4244
:returns: a requests Session object.
4345
"""
46+
if url is not None and hasattr(cls, '_session'):
47+
cls._session.close()
48+
delattr(cls, '_session')
4449
if not hasattr(cls, '_session'):
4550
if url:
4651
cls._session = BaseSession(url)

0 commit comments

Comments
 (0)