Skip to content

Commit 3358162

Browse files
committed
add files
1 parent b690ba2 commit 3358162

7 files changed

Lines changed: 587 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: CI/CD
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: [3.7, 3.8, 3.9, '3.10']
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install -e ".[dev]"
28+
29+
- name: Run tests
30+
env:
31+
DATABUNKER_API_URL: ${{ secrets.DATABUNKER_API_URL || 'https://pro.databunker.org' }}
32+
DATABUNKER_API_TOKEN: ${{ secrets.DATABUNKER_API_TOKEN }}
33+
DATABUNKER_TENANT_NAME: ${{ secrets.DATABUNKER_TENANT_NAME }}
34+
run: |
35+
pytest --cov=databunkerpro tests/ -v
36+
37+
- name: Upload coverage to Codecov
38+
uses: codecov/codecov-action@v2
39+
with:
40+
file: ./coverage.xml
41+
fail_ci_if_error: true
42+
43+
lint:
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v2
47+
48+
- name: Set up Python
49+
uses: actions/setup-python@v2
50+
with:
51+
python-version: '3.10'
52+
53+
- name: Install dependencies
54+
run: |
55+
python -m pip install --upgrade pip
56+
pip install -e ".[dev]"
57+
58+
- name: Run black
59+
run: black --check .
60+
61+
- name: Run isort
62+
run: isort --check-only .
63+
64+
- name: Run mypy
65+
run: mypy databunkerpro/
66+
67+
deploy:
68+
needs: [test, lint]
69+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
70+
runs-on: ubuntu-latest
71+
steps:
72+
- uses: actions/checkout@v2
73+
74+
- name: Set up Python
75+
uses: actions/setup-python@v2
76+
with:
77+
python-version: '3.10'
78+
79+
- name: Install dependencies
80+
run: |
81+
python -m pip install --upgrade pip
82+
pip install build twine
83+
84+
- name: Build package
85+
run: python -m build
86+
87+
- name: Publish to PyPI
88+
env:
89+
TWINE_USERNAME: __token__
90+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
91+
run: |
92+
twine upload dist/*

README.md

Lines changed: 104 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,104 @@
1-
# databunkerpro-python
1+
# DatabunkerPro Python Client
2+
3+
A Python client library for interacting with the DatabunkerPro API. This library provides a simple and intuitive interface for managing user data, tokens, and other DatabunkerPro features.
4+
5+
## Installation
6+
7+
You can install the package using pip:
8+
9+
```bash
10+
pip install databunkerpro
11+
```
12+
13+
Or install directly from GitHub:
14+
15+
```bash
16+
pip install git+https://github.com/yourusername/databunkerpro-python.git
17+
```
18+
19+
## Quick Start
20+
21+
```python
22+
from databunkerpro import DatabunkerproAPI
23+
24+
# Initialize the client
25+
api = DatabunkerproAPI(
26+
base_url="https://pro.databunker.org",
27+
x_bunker_token="your-api-token",
28+
x_bunker_tenant="your-tenant-name"
29+
)
30+
31+
# Create a new user
32+
user_data = {
33+
"email": "user@example.com",
34+
"name": "John Doe",
35+
"phone": "+1234567890"
36+
}
37+
result = api.create_user(user_data)
38+
print(f"Created user with token: {result['token']}")
39+
40+
# Get user information
41+
user = api.get_user("email", "user@example.com")
42+
print(f"User profile: {user['profile']}")
43+
44+
# Update user information
45+
update_data = {
46+
"name": "John Updated",
47+
"phone": "+0987654321"
48+
}
49+
api.update_user("email", "user@example.com", update_data)
50+
51+
# Create a token for sensitive data
52+
token_result = api.create_token("creditcard", "4111111111111111")
53+
print(f"Created token: {token_result['token']}")
54+
```
55+
56+
## Features
57+
58+
- User Management (create, read, update, delete)
59+
- Token Management
60+
- System Statistics
61+
- Type hints and comprehensive documentation
62+
- Error handling and validation
63+
64+
## Development
65+
66+
To set up the development environment:
67+
68+
1. Clone the repository:
69+
```bash
70+
git clone https://github.com/yourusername/databunkerpro-python.git
71+
cd databunkerpro-python
72+
```
73+
74+
2. Install development dependencies:
75+
```bash
76+
pip install -e ".[dev]"
77+
```
78+
79+
3. Run tests:
80+
```bash
81+
pytest
82+
```
83+
84+
## Contributing
85+
86+
Contributions are welcome! Please feel free to submit a Pull Request.
87+
88+
1. Fork the repository
89+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
90+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
91+
4. Push to the branch (`git push origin feature/amazing-feature`)
92+
5. Open a Pull Request
93+
94+
## License
95+
96+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
97+
98+
## Support
99+
100+
If you encounter any issues or have questions, please [open an issue](https://github.com/yourusername/databunkerpro-python/issues) on GitHub.
101+
102+
## API Documentation
103+
104+
For detailed API documentation, please visit the [DatabunkerPro API Documentation](https://docs.databunker.org).

databunkerpro/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"""
2+
DatabunkerPro Python Client Library
3+
A Python client library for interacting with the DatabunkerPro API.
4+
"""
5+
6+
from .api import DatabunkerproAPI
7+
8+
__version__ = "0.1.0"
9+
__all__ = ["DatabunkerproAPI"]

0 commit comments

Comments
 (0)