ndp-ep
A Python client library for interacting with the NDP EP API. This library provides a simple and intuitive interface for managing datasets, organizations, resources, and services through the API.
Features
- Complete API Coverage: Support for all API endpoints including Kafka topics, S3 resources, URL resources, organizations, and services
- Authentication: Token-based and username/password authentication
- Search Functionality: Advanced search capabilities across datasets and resources
- Error Handling: Comprehensive error handling with meaningful error messages
- Type Hints: Full type hint support for better IDE integration
- Testing: Extensive test coverage (>70%) with unit and integration tests
Installation
pip install ndp-ep
Quick Start
from ndp_ep import APIClient
# Initialize client with token
client = APIClient(
base_url="https://your-api-endpoint.com",
token="your-access-token"
)
# List organizations
organizations = client.list_organizations()
print(organizations)
# Search datasets
results = client.search_datasets(
terms=["climate", "temperature"],
server="global"
)
# Register a new organization
org_data = {
"name": "my_organization",
"title": "My Organization",
"description": "A sample organization"
}
response = client.register_organization(org_data)
# Register a service
service_data = {
"service_name": "user_auth_api",
"service_title": "User Authentication API",
"owner_org": "services",
"service_url": "https://api.example.com/auth",
"service_type": "API",
"notes": "RESTful API for user authentication"
}
response = client.register_service(service_data)
# S3 Management Examples
buckets = client.list_buckets()
client.create_bucket("my-data-bucket")
# Upload and download files
with open("data.csv", "rb") as f:
client.upload_object("my-data-bucket", "datasets/data.csv", f)
file_content = client.download_object("my-data-bucket", "datasets/data.csv")
# Generate presigned URLs for secure file sharing
upload_url = client.generate_presigned_upload_url("my-data-bucket", "new-file.txt")
download_url = client.generate_presigned_download_url("my-data-bucket", "data.csv")
More Examples
For comprehensive examples and use cases, check out our:
API Coverage
Authentication
- Token-based authentication
- Username/password authentication
Organizations
list_organizations()- List all organizationsregister_organization()- Create new organizationdelete_organization()- Delete organization
Datasets and Resources
search_datasets()- Search datasets with advanced filtersadvanced_search()- Advanced search with POST methodregister_url()- Register URL resourcesregister_s3_link()- Register S3 resourcesregister_kafka_topic()- Register Kafka topicsregister_general_dataset()- Register general datasetsupdate_url_resource()- Update URL resourcesupdate_s3_resource()- Update S3 resourcesupdate_kafka_topic()- Update Kafka topicsupdate_general_dataset()- Update general datasets (PUT)patch_general_dataset()- Partially update general datasets (PATCH)delete_resource_by_id()- Delete resource by IDdelete_resource_by_name()- Delete resource by name
Services
register_service()- Register new services
S3 Management
list_buckets()- List all S3 bucketscreate_bucket()- Create new S3 bucketget_bucket_info()- Get S3 bucket informationdelete_bucket()- Delete S3 bucketlist_objects()- List objects in S3 bucketupload_object()- Upload object to S3 bucketdownload_object()- Download object from S3 bucketdelete_object()- Delete object from S3 bucketget_object_metadata()- Get S3 object metadatagenerate_presigned_upload_url()- Generate presigned upload URLgenerate_presigned_download_url()- Generate presigned download URL
System Information
get_kafka_details()- Get Kafka connection detailsget_system_status()- Check system statusget_system_metrics()- Get system metricsget_jupyter_details()- Get Jupyter connection details
Development
Setting up development environment
# Clone the repository
git clone https://github.com/sci-ndp/ndp-ep-py.git
cd ndp-ep-py
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install development dependencies
pip install -e .
pip install -r requirements-dev.txt
Running tests
# Run all tests
pytest
# Run with coverage
pytest --cov=ndp_ep --cov-report=html
# Run specific test categories
pytest -m unit # Unit tests only
pytest -m integration # Integration tests only
Code formatting and linting
# Format code
black ndp_ep tests
# Lint code
flake8 ndp_ep
# Type checking
mypy ndp_ep
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests for your changes
- Ensure all tests pass and coverage is maintained
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Changelog
v0.1.0
- Initial release
- Complete API coverage for all endpoints
- Authentication support (token and username/password)
- Search functionality
- Resource management (URL, S3, Kafka)
- Organization management
- Comprehensive testing suite
Metadata
Release files for ndp-ep 0.10.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 | Provenance | Actions |
|---|---|---|---|---|
| ndp_ep-0.10.0.tar.gz | 66.0 kB | Without provenance | Details for ndp_ep-0.10.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ndp_ep-0.10.0-py3-none-any.whl | Python 3 | none | any | Details for ndp_ep-0.10.0-py3-none-any.whl |
Total release size: 118.4 kB
Release files / ndp_ep-0.10.0.tar.gz
| Download URL | ndp_ep-0.10.0.tar.gz |
|---|---|
| Size | 66.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
406524335d92f390fc8b123d6178f6cfbdcef631ad1bc8115dc5516c8fe1bc0a
|
|
BLAKE2b-256 checksum How to use checksums |
1fde603145bbfbdd5858037bb613875281d29d0e9b7b855131b2ce3d97c80f01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / ndp_ep-0.10.0-py3-none-any.whl
| Download URL | ndp_ep-0.10.0-py3-none-any.whl |
|---|---|
| Size | 52.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
762ee613831c9c6fd214991181345df6b23163fb5233f966f2f4f63929cee030
|
|
BLAKE2b-256 checksum How to use checksums |
ea858177184076b644be955419d335ba9b6ed532acff2dfdae9a41b4e8274eef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for ndp-ep 0.10.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.