1818CACHE_LIMIT = 300
1919
2020
21- class TibiaResponse :
21+ # This class is not used in this release.
22+ class _TibiaResponse : # pragma: no cover
2223 def __init__ (self , data = None , cache_limit = CACHE_LIMIT , ** kwargs ):
2324 self .data = None
2425 self .cached = kwargs .get ("cached" )
@@ -59,7 +60,7 @@ def __init__(self, loop=None, session=None, *, proxy_url=None):
5960
6061 async def _initialize_session (self , proxy_url = None ):
6162 headers = {
62- 'User-Agent' : "Tibia.py/%s (+https://github.com/Galarzaa90/tibia.py" % tibiapy .__version__ ,
63+ 'User-Agent' : "Tibia.py/%s (+https://github.com/Galarzaa90/tibia.py) " % tibiapy .__version__ ,
6364 'Accept-Encoding' : "deflate, gzip"
6465 }
6566 connector = aiohttp_socks .SocksConnector .from_url (proxy_url ) if proxy_url else None
@@ -105,6 +106,8 @@ async def _get(self, url):
105106 raise NetworkError ("aiohttp.ClientError: %s" % e , e )
106107 except aiohttp_socks .SocksConnectionError as e :
107108 raise NetworkError ("aiohttp_socks.SocksConnectionError: %s" % e , e )
109+ except UnicodeDecodeError as e :
110+ raise NetworkError ('UnicodeDecodeError: %s' % e , e )
108111
109112 async def _post (self , url , data ):
110113 """Base POST request, handling possible error statuses.
@@ -127,6 +130,10 @@ async def _post(self, url, data):
127130 return await resp .text ()
128131 except aiohttp .ClientError as e :
129132 raise NetworkError ("aiohttp.ClientError: %s" % e , e )
133+ except aiohttp_socks .SocksConnectionError as e :
134+ raise NetworkError ("aiohttp_socks.SocksConnectionError: %s" % e , e )
135+ except UnicodeDecodeError as e :
136+ raise NetworkError ('UnicodeDecodeError: %s' % e , e )
130137
131138 async def fetch_boosted_creature (self ):
132139 """Fetches today's boosted creature.
@@ -420,9 +427,9 @@ async def fetch_news_archive(self, begin_date, end_date, categories=None, types=
420427 if begin_date > end_date :
421428 raise ValueError ("begin_date can't be more recent than end_date" )
422429 if not categories :
423- categories = NewsCategory . items ( )
430+ categories = list ( NewsCategory )
424431 if not types :
425- types = NewsType . items ( )
432+ types = list ( NewsType )
426433 data = {
427434 "filter_begin_day" : begin_date .day ,
428435 "filter_begin_month" : begin_date .month ,
0 commit comments