Skip to content

Commit 8a64e61

Browse files
committed
Rename project cause of name collision
As there already another project with the name we selct, we need to rename our project.
1 parent d8ef0a3 commit 8a64e61

File tree

8 files changed

+45
-45
lines changed

8 files changed

+45
-45
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ help:
1515
@echo " lint - to run code linting"
1616

1717
lint:
18-
flake8 pyhpipam
18+
flake8 phpypam
1919

2020
dist:
2121
python3 setup.py sdist bdist_wheel

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# pyhpipam
1+
# phpypam
22

33
Python API client library for [phpIPAM](https://phpipam.net/) installations.
44

pyhpipam/__init__.py renamed to phpypam/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from pkg_resources import get_distribution, DistributionNotFound
22

3-
from pyhpipam.core.api import Api as api
4-
from pyhpipam.core.exceptions import PyHPIPAMEntityNotFoundException
3+
from phpypam.core.api import Api as api
4+
from phpypam.core.exceptions import PHPyPAMEntityNotFoundException
55

66
try:
77
__version__ = get_distribution(__name__).version
File renamed without changes.

pyhpipam/core/api.py renamed to phpypam/core/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import requests
66

77
from requests.auth import HTTPBasicAuth
8-
from pyhpipam.core.exceptions import PyHPIPAMException
8+
from phpypam.core.exceptions import PHPyPAMException
99

1010
GET = requests.get
1111
POST = requests.post
@@ -84,7 +84,7 @@ def _query(self, **kwargs):
8484
result = resp.json()
8585

8686
if result['code'] not in (200, 201) or not result['success']:
87-
raise PyHPIPAMException(code=result['code'], message=result['message'])
87+
raise PHPyPAMException(code=result['code'], message=result['message'])
8888
else:
8989
if 'data' in result:
9090
return result['data']

phpypam/core/exceptions.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# provides the main query methods.
2+
3+
import json
4+
5+
6+
class PHPyPAMException(Exception):
7+
8+
def __init__(self, *args, **kwargs):
9+
self._code = kwargs.pop('code', None)
10+
self._message = kwargs.pop('message', None)
11+
12+
if self._code == 500:
13+
if self._message == 'Invalid username or password':
14+
raise PHPyPAMInvalidCredentials(self._message)
15+
elif self._code == 400:
16+
raise PHPyPAMInvalidSyntax(message=self._message)
17+
elif self._code == 404:
18+
raise PHPyPAMEntityNotFoundException(self._message)
19+
20+
# super(PHPyPAMException, self).__init__(*args, **kwargs)
21+
22+
23+
class PHPyPAMInvalidCredentials(Exception):
24+
def __init__(self, *args, **kwargs):
25+
super(PHPyPAMInvalidCredentials, self).__init__(*args, **kwargs)
26+
27+
28+
class PHPyPAMEntityNotFoundException(Exception):
29+
def __init__(self, *args, **kwargs):
30+
super(PHPyPAMEntityNotFoundException, self).__init__(*args, **kwargs)
31+
32+
33+
class PHPyPAMInvalidSyntax(Exception):
34+
def __init__(self, *args, **kwargs):
35+
self._message = kwargs.pop('message', '')
36+
37+
super(PHPyPAMInvalidSyntax, self).__init__(self._message, *args, **kwargs)

pyhpipam/core/exceptions.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
long_description = fh.read()
55

66
setuptools.setup(
7-
name="pyhpipam",
7+
name="phpypam",
88
version="0.0.1",
99
author="Christian Meißner",
1010
author_email="Christian Meißner <[email protected]>",
@@ -13,7 +13,7 @@
1313
long_description_content_type="text/markdown",
1414
license="GPLv3",
1515
platform="Independent",
16-
url="https://codeaffen.github.io/pyhpipam",
16+
url="https://codeaffen.github.io/phpypam",
1717
packages=setuptools.find_packages(),
1818
classifiers=[
1919
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",

0 commit comments

Comments
 (0)