Skip to content

Commit

Permalink
Merge pull request #33 from lendingblock/master
Browse files Browse the repository at this point in the history
0.3.0
  • Loading branch information
lsbardel authored Aug 19, 2018
2 parents 0d01ef0 + 332b6f5 commit 5feeb75
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,10 @@ dist
.env
*.log

# ides
.vscode/.ropeproject
.idea
*.swp

# Mac
.DS_Store
2 changes: 1 addition & 1 deletion kong/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Asynchronous Kong client"""

__version__ = '0.2.8'
__version__ = '0.3.0'
7 changes: 5 additions & 2 deletions kong/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Kong:

def __init__(self, url: str=None, session: object=None) -> None:
self.url = url or self.url
self.session = session or aiohttp.ClientSession()
self.session = session
self.services = Services(self)
self.plugins = Plugins(self)
self.consumers = Consumers(self)
Expand All @@ -42,7 +42,8 @@ def cli(self):
return self

async def close(self) -> None:
await self.session.close()
if self.session:
await self.session.close()

async def __aenter__(self) -> object:
return self
Expand All @@ -53,6 +54,8 @@ async def __aexit__(self, exc_type, exc_val, exc_tb) -> None:
async def execute(self, url, method=None, headers=None,
callback=None, wrap=None, timeout=None, skip_error=None,
**kw):
if not self.session:
self.session = aiohttp.ClientSession()
method = method or 'GET'
headers = headers or {}
headers['Accept'] = 'application/json, text/*; q=0.5'
Expand Down

0 comments on commit 5feeb75

Please sign in to comment.