Skip to content

Commit

Permalink
Merge branch 'release-v1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
whoisxmlapi committed Apr 22, 2021
2 parents 2324736 + 5ce1756 commit 81ee856
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 13 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.rst
Expand Up @@ -2,9 +2,14 @@
Changelog
=========

1.1.0 (2021-04-22)
------------------
* Minor fixes
* UnparsableApiResponse error class was renamed to UnparsableApiResponseError

1.0.1 (2021-04-21)
------------------
README update.
* README update.

1.0.0 (2021-04-20)
------------------
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -22,7 +22,7 @@ def read(*names, **kwargs):

setup(
name='reverse-ip',
version='1.0.1',
version='1.1.0',
python_requires='>=3.6',
license='MIT',
description='Python client library for Reverse IP/DNS API.',
Expand Down
6 changes: 3 additions & 3 deletions src/reverseip/__init__.py
@@ -1,11 +1,11 @@
__all__ = ['Client', 'ErrorMessage', 'ReverseIpApiError', 'ApiAuthError',
'HttpApiError', 'EmptyApiKeyError', 'ParameterError',
'ResponseError', 'BadRequestError', 'UnparsableApiResponse',
'ResponseError', 'BadRequestError', 'UnparsableApiResponseError',
'ApiRequester', 'Result', 'Record']

from .client import Client
from .net.http import ApiRequester
from .models.response import ErrorMessage, Result, Record
from .exceptions.error import ReverseIpApiError, ParameterError, \
EmptyApiKeyError, ResponseError, UnparsableApiResponse, ApiAuthError, \
BadRequestError, HttpApiError
EmptyApiKeyError, ResponseError, UnparsableApiResponseError, \
ApiAuthError, BadRequestError, HttpApiError
10 changes: 5 additions & 5 deletions src/reverseip/client.py
Expand Up @@ -5,7 +5,7 @@
from .net.http import ApiRequester
from .models.response import Result
from .exceptions.error import ParameterError, EmptyApiKeyError, \
UnparsableApiResponse, CannotRetrieveNextPageError
UnparsableApiResponseError, CannotRetrieveNextPageError


class Client:
Expand Down Expand Up @@ -80,7 +80,7 @@ def data(self, ip: str or IPv4Address, **kwargs) -> Result:
- ApiAuthError -- Server returned 401, 402 or 403 HTTP code
- BadRequestError - Server returned 400 or 422 HTTP code
- HttpApiError -- HTTP code >= 300 and not equal to above codes from
- UnparsableApiResponse -- the response couldn't be parsed
- UnparsableApiResponseError -- the response couldn't be parsed
- ParameterError -- invalid parameter's value
- ConnectionError
"""
Expand All @@ -92,10 +92,10 @@ def data(self, ip: str or IPv4Address, **kwargs) -> Result:
parsed = loads(str(response))
if 'result' in parsed:
return Result(parsed)
raise UnparsableApiResponse(
raise UnparsableApiResponseError(
"Could not find the correct root element.", None)
except JSONDecodeError as error:
raise UnparsableApiResponse("Could not parse API response", error)
raise UnparsableApiResponseError("Could not parse API response", error)

def next_page(self, ip: str or IPv4Address, current_page: Result) -> Result:
"""
Expand Down Expand Up @@ -179,7 +179,7 @@ def _validate_ip(ip):

@staticmethod
def _validate_domain_name(domain):
if domain is not None and len(str(domain)) > 4:
if domain is not None and len(str(domain)) > 0:
return domain
raise ParameterError('Invalid domain name.')

Expand Down
4 changes: 2 additions & 2 deletions src/reverseip/exceptions/__init__.py
@@ -1,6 +1,6 @@
__all__ = ['ParameterError', 'HttpApiError', 'ReverseIpApiError',
'ApiAuthError', 'ResponseError', 'EmptyApiKeyError',
'UnparsableApiResponse']
'UnparsableApiResponseError']

from .error import ParameterError, HttpApiError, ReverseIpApiError, \
ApiAuthError, ResponseError, EmptyApiKeyError, UnparsableApiResponse
ApiAuthError, ResponseError, EmptyApiKeyError, UnparsableApiResponseError
2 changes: 1 addition & 1 deletion src/reverseip/exceptions/error.py
Expand Up @@ -45,7 +45,7 @@ def parsed_message(self, pm):
self._parsed_message = pm


class UnparsableApiResponse(ReverseIpApiError):
class UnparsableApiResponseError(ReverseIpApiError):
def __init__(self, message, origin_error):
self.message = message
self.original_error = origin_error
Expand Down

0 comments on commit 81ee856

Please sign in to comment.