Skip to content

Commit 9added6

Browse files
committed
Fix #38 - http vs. https connections
As the try to connect to an unsecure api endpoint with user token leads to an exception we need to adapt our exception handling to print out the full and correct information. As `https` connections are industry standard we don't invest much effort in implementation of the `encryption` feature. If anybody needs this feature feel free to contribute or file a feature request where interested can vote on.
1 parent b781e6a commit 9added6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

phpypam/core/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def __init__(self, url, app_id, username=None, password=None, token=None, encryp
2727
2828
The costructor collects all data to connect to phpIPAM API. If all data is there it makes the connection to the given server.
2929
30-
:param url: The URL to a phpIPAM instance. It includes the protocol (`http` or `https`).
30+
:param url: The URL to a phpIPAM instance. As phpIPAM expects `https` we also only supports secure connections.
3131
:type url: str
3232
:param app_id: The app_id which is used for the API operations.
3333
For modifying operations it needs read/write access.

phpypam/core/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def __init__(self, *args, code=None, message=None):
3939
elif self._code == 500:
4040
if self._message == 'Invalid username or password':
4141
raise PHPyPAMInvalidCredentials(self._message)
42-
elif self._code == 400:
42+
elif self._code == 400 or self._code == 503:
4343
raise PHPyPAMInvalidSyntax(message=self._message)
4444

4545
# super(PHPyPAMException, self).__init__(*args, **kwargs)

0 commit comments

Comments
 (0)