Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Galarzaa90 committed Aug 17, 2019
2 parents dc8dbe1 + 84f4f12 commit 919c87e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,19 @@ Changelog
Due to this library relying on external content, older versions are not guaranteed to work.
Try to always use the latest version.

.. _v2.2.3:

2.2.3 (2019-08-17)
==================

- Enabled client side compression

.. _v2.2.2:

2.2.2 (2019-08-17)
==================

- Fixed killed by players and palyers kill stats being inverted for ``KillStatistics``
- Fixed killed by players and players kill stats being inverted for ``KillStatistics``

.. _v2.2.1:

Expand Down
2 changes: 1 addition & 1 deletion tibiapy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from tibiapy.creature import *
from tibiapy.client import *

__version__ = '2.2.1'
__version__ = '2.2.3'

from logging import NullHandler

Expand Down
7 changes: 4 additions & 3 deletions tibiapy/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ def __init__(self, loop=None, session=None):

async def _initialize_session(self):
headers = {
'User-Agent ': "Tibia.py/%s (+https://github.com/Galarzaa90/tibia.py" % tibiapy.__version__
'User-Agent': "Tibia.py/%s (+https://github.com/Galarzaa90/tibia.py" % tibiapy.__version__,
'Accept-Encoding': "deflate, gzip"
}
self.session = aiohttp.ClientSession(loop=self.loop, headers=headers) # type: aiohttp.ClientSession

Expand Down Expand Up @@ -75,7 +76,7 @@ async def _get(self, url):
If there's any connection errors during the request.
"""
try:
async with self.session.get(url) as resp:
async with self.session.get(url, compress=True) as resp:
self._handle_status(resp.status)
return await resp.text()
except aiohttp.ClientError as e:
Expand All @@ -97,7 +98,7 @@ async def _post(self, url, data):
The text content of the response.
"""
try:
async with self.session.post(url, data=data) as resp:
async with self.session.post(url, data=data, compress=True) as resp:
self._handle_status(resp.status)
return await resp.text()
except aiohttp.ClientError as e:
Expand Down

0 comments on commit 919c87e

Please sign in to comment.