Name | skfobserver JSON |
Version |
0.1.3
JSON |
| download |
home_page | None |
Summary | A Python client library for easy integration with the SKF Observer API. |
upload_time | 2025-09-02 18:42:01 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | MIT License
Copyright (c) 2025 SKF
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. |
keywords |
skf
observer
api
client
sdk
data
industrial
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
Markdown
# SKF Observer Python Library
A robust and easy-to-use Python client library designed to simplify integration with the SKF Observer API. This library handles authentication, token refreshing, and provides intuitive methods for reading data and interacting with your Observer application programmatically.
## Features
- **Seamless Authentication:** Automatic handling of access and refresh tokens.
- **Easy Data Access:** Simple Python functions to retrieve machine data, events, and other Observer resources.
- **Error Handling:** Built-in error handling for common API responses.
- **Structured Interface:** A clear, object-oriented approach to API interaction.
## Installation
You can install `skfobserver` using pip:
```bash
pip install skfobserver
```
USAGE
```bash
from skfobserver import APIClient
from skfobserver.client import SKFObserverAPIError # For specific error handling
from datetime import datetime, timedelta
# Replace with your actual SKF Observer API credentials
USERNAME = "YOUR_API_USERNAME"
PASSWORD = "YOUR_API_PASSWORD"
try:
# Initialize the client (authentication happens automatically here)
client = APIClient(username=USERNAME, password=PASSWORD)
# Example 1: Get a list of all machines
print("Fetching machines...")
machines = client.get_machines()
for machine in machines:
print(f" Machine ID: {machine.get('id')}, Name: {machine.get('name')}")
# Example 2: Get data for a specific machine over the last 24 hours
if machines:
target_machine_id = machines[0].get('id') # Use the first machine found
print(f"\nFetching data for machine ID: {target_machine_id} (last 24 hours)...")
end_time = datetime.now()
start_time = end_time - timedelta(days=1)
machine_data = client.get_machine_data(
machine_id=target_machine_id,
start_time=start_time,
end_time=end_time
)
print(f" Retrieved {len(machine_data)} data points for {target_machine_id}.")
# print(f" First data point: {machine_data[0]}") # Uncomment to see actual data
# Example 3: Send an event to the API
print("\nSending a test event...")
event_payload = {
"type": "MAINTENANCE_LOG",
"machineId": "some_machine_id", # Replace with a valid machine ID for testing
"timestamp": datetime.now().isoformat(),
"description": "Routine check completed by automated script.",
"severity": "INFO"
}
response_event = client.send_event(event_payload)
print(f" Event sent successfully. Response ID: {response_event.get('eventId')}")
except SKFObserverAuthError as e:
print(f"Authentication Error: {e}")
print("Please check your username and password, or if your refresh token has expired, re-initialize the client.")
except SKFObserverAPIError as e:
print(f"API Error: {e}")
except Exception as e:
print(f"An unexpected error occurred: {e}")
```
Raw data
{
"_id": null,
"home_page": null,
"name": "skfobserver",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "skf, observer, api, client, sdk, data, industrial",
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/92/b8/758841c9b24468546a7a7cc7379686d52c7bf176347ae07860ae28a1efc3/skfobserver-0.1.3.tar.gz",
"platform": null,
"description": "Markdown\r\n\r\n# SKF Observer Python Library\r\n\r\nA robust and easy-to-use Python client library designed to simplify integration with the SKF Observer API. This library handles authentication, token refreshing, and provides intuitive methods for reading data and interacting with your Observer application programmatically.\r\n\r\n## Features\r\n\r\n- **Seamless Authentication:** Automatic handling of access and refresh tokens.\r\n- **Easy Data Access:** Simple Python functions to retrieve machine data, events, and other Observer resources.\r\n- **Error Handling:** Built-in error handling for common API responses.\r\n- **Structured Interface:** A clear, object-oriented approach to API interaction.\r\n\r\n## Installation\r\n\r\nYou can install `skfobserver` using pip:\r\n\r\n```bash\r\npip install skfobserver\r\n```\r\n\r\n\r\nUSAGE \r\n\r\n\r\n```bash\r\nfrom skfobserver import APIClient\r\nfrom skfobserver.client import SKFObserverAPIError # For specific error handling\r\nfrom datetime import datetime, timedelta\r\n\r\n# Replace with your actual SKF Observer API credentials\r\nUSERNAME = \"YOUR_API_USERNAME\"\r\nPASSWORD = \"YOUR_API_PASSWORD\"\r\n\r\ntry:\r\n # Initialize the client (authentication happens automatically here)\r\n client = APIClient(username=USERNAME, password=PASSWORD)\r\n\r\n # Example 1: Get a list of all machines\r\n print(\"Fetching machines...\")\r\n machines = client.get_machines()\r\n for machine in machines:\r\n print(f\" Machine ID: {machine.get('id')}, Name: {machine.get('name')}\")\r\n\r\n # Example 2: Get data for a specific machine over the last 24 hours\r\n if machines:\r\n target_machine_id = machines[0].get('id') # Use the first machine found\r\n print(f\"\\nFetching data for machine ID: {target_machine_id} (last 24 hours)...\")\r\n end_time = datetime.now()\r\n start_time = end_time - timedelta(days=1)\r\n machine_data = client.get_machine_data(\r\n machine_id=target_machine_id,\r\n start_time=start_time,\r\n end_time=end_time\r\n )\r\n print(f\" Retrieved {len(machine_data)} data points for {target_machine_id}.\")\r\n # print(f\" First data point: {machine_data[0]}\") # Uncomment to see actual data\r\n\r\n # Example 3: Send an event to the API\r\n print(\"\\nSending a test event...\")\r\n event_payload = {\r\n \"type\": \"MAINTENANCE_LOG\",\r\n \"machineId\": \"some_machine_id\", # Replace with a valid machine ID for testing\r\n \"timestamp\": datetime.now().isoformat(),\r\n \"description\": \"Routine check completed by automated script.\",\r\n \"severity\": \"INFO\"\r\n }\r\n response_event = client.send_event(event_payload)\r\n print(f\" Event sent successfully. Response ID: {response_event.get('eventId')}\")\r\n\r\nexcept SKFObserverAuthError as e:\r\n print(f\"Authentication Error: {e}\")\r\n print(\"Please check your username and password, or if your refresh token has expired, re-initialize the client.\")\r\nexcept SKFObserverAPIError as e:\r\n print(f\"API Error: {e}\")\r\nexcept Exception as e:\r\n print(f\"An unexpected error occurred: {e}\") \r\n\r\n\r\n```\r\n \r\n\r\n",
"bugtrack_url": null,
"license": "MIT License\r\n \r\n Copyright (c) 2025 SKF\r\n \r\n Permission is hereby granted, free of charge, to any person obtaining a copy\r\n of this software and associated documentation files (the \"Software\"), to deal\r\n in the Software without restriction, including without limitation the rights\r\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n copies of the Software, and to permit persons to whom the Software is\r\n furnished to do so, subject to the following conditions:\r\n \r\n The above copyright notice and this permission notice shall be included in all\r\n copies or substantial portions of the Software.\r\n \r\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n SOFTWARE.",
"summary": "A Python client library for easy integration with the SKF Observer API.",
"version": "0.1.3",
"project_urls": {
"Changelog": "https://github.com/your-github-org/skfobserver-python/releases",
"Documentation": "https://your-docs-url.readthedocs.io",
"Homepage": "https://github.com/your-github-org/skfobserver-python",
"Repository": "https://github.com/your-github-org/skfobserver-python"
},
"split_keywords": [
"skf",
" observer",
" api",
" client",
" sdk",
" data",
" industrial"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "3d48d8e9b2ab14abe38f0f826504e07b20efbc021f58e1725c12079a8f093d21",
"md5": "39715510785d85509445102b1699c268",
"sha256": "a47eda896786e89814811e0a95808e0bb2eddc59d4d5a42441bdf2a524f0387c"
},
"downloads": -1,
"filename": "skfobserver-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "39715510785d85509445102b1699c268",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 14160,
"upload_time": "2025-09-02T18:41:59",
"upload_time_iso_8601": "2025-09-02T18:41:59.139983Z",
"url": "https://files.pythonhosted.org/packages/3d/48/d8e9b2ab14abe38f0f826504e07b20efbc021f58e1725c12079a8f093d21/skfobserver-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "92b8758841c9b24468546a7a7cc7379686d52c7bf176347ae07860ae28a1efc3",
"md5": "048448b4e8c506c2d991edf0f486e432",
"sha256": "e37e1aabd6ab83a1e3c6905d9fca5a23f26674d692a7194cefa9ec4875cf88a3"
},
"downloads": -1,
"filename": "skfobserver-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "048448b4e8c506c2d991edf0f486e432",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 17682,
"upload_time": "2025-09-02T18:42:01",
"upload_time_iso_8601": "2025-09-02T18:42:01.775011Z",
"url": "https://files.pythonhosted.org/packages/92/b8/758841c9b24468546a7a7cc7379686d52c7bf176347ae07860ae28a1efc3/skfobserver-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-02 18:42:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "your-github-org",
"github_project": "skfobserver-python",
"github_not_found": true,
"lcname": "skfobserver"
}