Skip to content

Commit

Permalink
ComplianceFetcher.session is resettable (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
alfinkel authored Aug 28, 2020
1 parent 8ccbcc5 commit 6f05b77
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
6 changes: 5 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion compliance/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
# limitations under the License.
"""Compliance automation package."""

__version__ = '1.2.5'
__version__ = '1.2.6'
7 changes: 6 additions & 1 deletion compliance/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6f05b77

Please sign in to comment.