NFON Service Portal API Client
EN:
Starter client for authenticated access to the NFON Service Portal API.
DE:
Einfacher Einstieg in die authentifizierte Nutzung der NFON Service Portal API.
📄 Link to official docs:
https://www.nfon.com/en/service/documentation/manuals/web-applications/nfon-service-portal-api/nfon-service-portal-api-manual/
Installation
Clone this repository or install as part of your project.
Example Usage
from nfon_api_client import NfonApiBaseClient
napi = NfonApiBaseClient(
uid="KXXXX",
api_key="your_key",
api_secret="your_secret",
api_base_url="https://nfon.example.com"
)
# Use .ep(key, **kwargs) to resolve endpoints
endpoint = napi.ep('customers')
response = napi.get(endpoint)
# Use a customer-specific endpoint
customer_id = "K1234"
endpoint = napi.ep('customer_basic_data', customer_id=customer_id)
response = napi.get(endpoint)
print(response.json())
Or start building your own Subclass to fit your needs:
from nfon_api_client import NfonApiBaseClient
class NfonApiClient(NfonApiBaseClient):
def __init__(self, user_id, key, secret, base_url):
super().__init__(user_id, key, secret, base_url)
@staticmethod
def list_to_dict(data):
return {item['name']: item['value'] for item in data}
@staticmethod
def dict_to_list(data, key='name', value='value'):
return [{key: k, value: v} for k, v in data.items()]
# etc...etc...
Error Handling
This library defines custom exceptions to help you handle different failure modes cleanly:
NFONApiError– Base class for all API-related errorsAuthHeaderError– Raised when the authentication header cannot be generatedRequestFailed– Raised when an HTTP request fails (e.g., network issue or server error)EndpointFormatError– Raised when.ep()is called with missing or incorrect arguments
Example:
from nfon_api_client import NfonApiBaseClient
from nfon_api_client.exceptions import RequestFailed, AuthHeaderError
napi = NfonApiBaseClient("KXXXX", "your_key", "your_secret", "https://nfon.example.com")
try:
response = napi.get(napi.ep('version'))
print(response.json())
except RequestFailed as e:
print("Request failed:", e)
except AuthHeaderError as e:
print("Header generation failed:", e)
Metadata
Release files for nfon-api-client 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nfon_api_client-0.1.0.tar.gz | 10.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nfon_api_client-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.0 kB
Release files / nfon_api_client-0.1.0.tar.gz
| Download URL | nfon_api_client-0.1.0.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d64ff592ea67566d0f001178818be447f0a68405e729c85d06cc7be38ad29e18
|
|
BLAKE2b-256 checksum How to use checksums |
ce0c29a389460ddcf62bfeca6863bed97d7cff7e229d6dfa6eea63295115eacc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|
Release files / nfon_api_client-0.1.0-py3-none-any.whl
| Download URL | nfon_api_client-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e62c92e5bea063ed4f74e53e9878fe34cbf7d203b802c3444d9dfdd21adf6000
|
|
BLAKE2b-256 checksum How to use checksums |
1d2b081d375e1b046727c2effbacc541e2c24ad407f52a4d1f5e537bdd185c4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|