Prepair for release 1.0.0

This commit is contained in:
Dionysus 2024-12-23 19:22:02 -05:00
parent a4c8b9db4f
commit ae9994e45e
Signed by: acidvegas
GPG Key ID: EF4B922DB85DC9DE
6 changed files with 119 additions and 3 deletions

36
.gitignore vendored Normal file
View File

@ -0,0 +1,36 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
# Virtual Environment
venv/
ENV/
env/
# IDE
.idea/
.vscode/
*.swp
*.swo
# OS
.DS_Store
Thumbs.db

15
LICENSE Normal file
View File

@ -0,0 +1,15 @@
ISC License
Copyright (c) 2025, acidvegas <acid.vegas@acid.vegas>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View File

@ -6,6 +6,19 @@ The North American Numbering Plan *(NANP)* is the unified telephone numbering sy
This client provides a simple interface to NANPA's public API endpoints, allowing developers to programmatically access critical numbering plan data and network information. This client provides a simple interface to NANPA's public API endpoints, allowing developers to programmatically access critical numbering plan data and network information.
## Installation
```bash
pip install nanpa
```
or...
```bash
git clone https://github.com/acidvegas/nanpa
cd nanpa
python setup.py install
```
## API Documentation ## API Documentation
### State & Area Code Information ### State & Area Code Information
@ -41,3 +54,7 @@ changes = client.get_rate_center_changes(
'2024-12-31T23:59:59.999-05:00' '2024-12-31T23:59:59.999-05:00'
) )
``` ```
---
###### Mirrors: [acid.vegas](https://git.acid.vegas/nanpa) • [SuperNETs](https://git.supernets.org/acidvegas/nanpa) • [GitHub](https://github.com/acidvegas/nanpa) • [GitLab](https://gitlab.com/acidvegas/nanpa) • [Codeberg](https://codeberg.org/acidvegas/nanpa)

5
nanpa/nanpa/__init__.py Normal file
View File

@ -0,0 +1,5 @@
from .client import NanpaAPI
__version__ = '1.0.0'
__author__ = 'acidvegas'
__all__ = ['NanpaAPI']

View File

@ -14,7 +14,6 @@ class NanpaAPI:
self.base_url = 'https://api.nanpa.com/reports/public' self.base_url = 'https://api.nanpa.com/reports/public'
def _make_request(self, endpoint: str, params: dict = None) -> dict: def _make_request(self, endpoint: str, params: dict = None) -> dict:
''' '''
Make a request to the NANPA API. Make a request to the NANPA API.
@ -48,6 +47,7 @@ class NanpaAPI:
:param npa: Area code to lookup :param npa: Area code to lookup
''' '''
params = {'npa': npa} params = {'npa': npa}
return self._make_request('npa/areaCodeListing', params) return self._make_request('npa/areaCodeListing', params)
@ -71,6 +71,7 @@ class NanpaAPI:
:param state: Two-letter state code :param state: Two-letter state code
:param npa: Area code :param npa: Area code
''' '''
params = {'state': state, 'npa': npa} params = {'state': state, 'npa': npa}
@ -190,14 +191,16 @@ class NanpaAPI:
:param npa: Area code :param npa: Area code
:param report_type: Report type (default: AS) :param report_type: Report type (default: AS)
''' '''
params = {'state': state, 'npa': npa, 'reportType': report_type} params = {'state': state, 'npa': npa, 'reportType': report_type}
return self._make_request('tbco/thousandsBlocks', params) return self._make_request('tbco/thousandsBlocks', params)
def main(): def main():
'''Example usage of the NANPA API client.''' '''Example usage of the NANPA API client.'''
client = NanpaAPI() client = NanpaAPI()
# Example API calls # Example API calls
@ -212,4 +215,4 @@ def main():
if __name__ == '__main__': if __name__ == '__main__':
main() main()

40
setup.py Normal file
View File

@ -0,0 +1,40 @@
#!/usr/bin/env python
# North American Numbering Plan Administration (NANPA) API Client - Developed by acidvegas in Python (https://git.acid.vegas/nanpa)
# setup.py
from setuptools import setup, find_packages
with open('README.md', encoding='utf-8') as fh:
long_description = fh.read()
setup(
name='nanpa',
version='1.0.0',
author='acidvegas',
author_email='acid.vegas@acid.vegas',
description='North American Numbering Plan Administration (NANPA) API Client',
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/acidvegas/nanpa',
project_urls={
'Source Code': 'https://github.com/acidvegas/nanpa',
},
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Communications :: Telephony',
],
packages=find_packages(),
python_requires='>=3.6',
)