Skip to content

Commit 5a9b137

Browse files
committed
Initial commit
0 parents  commit 5a9b137

File tree

10 files changed

+1249
-0
lines changed

10 files changed

+1249
-0
lines changed

.github/workflows/lint.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Ruff and Mypy Checks
2+
3+
on:
4+
push: # Triggers on all branches
5+
pull_request: # Triggers on all PRs
6+
7+
jobs:
8+
lint:
9+
name: Run Ruff and Mypy
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.11'
20+
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install uv
25+
uv sync --group lint
26+
27+
- name: Run Ruff
28+
run: |
29+
uv run --frozen python -m ruff check
30+
31+
- name: Run Mypy
32+
run: |
33+
uv run --frozen python -m mypy

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.idea/
2+
venv/
3+
/dist/
4+
/output/ssp_output.ssp
5+
/output/ssd_output.ssp

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 eXXcellent solutions
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
![easyssp-logo-light](https://raw.githubusercontent.com/exxcellent/easyssp-auth-client-python/refs/heads/master/images/logo-light.png#gh-light-mode-only)
2+
![easyssp-logo-dark](https://raw.githubusercontent.com/exxcellent/easyssp-auth-client-python/refs/heads/master/images/logo-dark.png#gh-dark-mode-only)
3+
4+
# 📘 easySSP – Import/Export Client Examples
5+
6+
This repository provides real-world examples for using the
7+
official [easySSP Import/Export Client](https://github.com/exxcellent/easyssp-import-export-client-python). Whether
8+
you're testing the API or building production workflows, these scripts will help you get started quickly.
9+
10+
---
11+
12+
## 🎯 What’s Inside
13+
14+
- 🔐 Authentication via the authentication module
15+
- 🧪 Import and export .ssp/.ssd files
16+
- 📘 **Includes documentation for all Import/Export API endpoints and models**
17+
18+
---
19+
20+
## 📁 Repository Structure
21+
22+
```bash
23+
easyssp-import-export-examples-python/
24+
├── demo.py # Run a basic scenario
25+
├── input/
26+
│ └── ssd_example.ssd # SSD file for importing
27+
│ └── ssp_example.ssp # SSP file for importing
28+
└── output # Directory for storing the exported SSP models.
29+
```
30+
31+
# 🚀 Getting Started with easySSP Import/Export Examples
32+
33+
This guide walks you through setting up and running the example scripts provided in the easySSP Import/Export Examples
34+
repository.
35+
36+
---
37+
38+
## 1. Clone the Repository
39+
40+
To begin, clone the repository and navigate into the project directory:
41+
42+
- Clone the repo:
43+
`git clone https://github.com/exxcellent/easyssp-import-export-examples-python.git`
44+
- Change into the directory:
45+
`cd easyssp-import-export-examples-python`
46+
47+
---
48+
49+
## 2. Install Dependencies
50+
51+
Ensure you have Python 3.11 or higher installed and a Pro Edition easySSP Account.
52+
Create the virtual environment by running
53+
54+
```bash
55+
python -m venv .venv
56+
.\.venv\Scripts\activate # or source .venv/bin/activate on macOS
57+
```
58+
59+
Then, install all required dependencies using uv:
60+
61+
```bash
62+
pip install uv
63+
uv sync
64+
```
65+
66+
---
67+
68+
## 3. Provide your login credentials
69+
70+
In the `demo.py` file, replace `your_easyssp_username` and `your_easyssp_password` with your real easySSP credentials
71+
to start the demo.
72+
73+
---
74+
75+
## 4. Run an Example Script
76+
77+
### 📂 Input & Output Directories
78+
79+
This repository uses structured folders to organize data and results:
80+
81+
#### 📥 `input/`
82+
83+
The `input/` directory contains .ssd and .ssp files used for **import**.
84+
Each script pulls its input data from this folder when submitting a request to the Import/Export API.
85+
86+
---
87+
88+
#### 📤 `output/`
89+
90+
The `output/` directory is where **exported SSP models** are stored.
91+
This separation of input and output ensures clarity, reproducibility, and easy cleanup.
92+
93+
---
94+
95+
#### 🧪 `demo.py`
96+
97+
The `demo.py` script in the `demo` directory acts as a **central demo runner** and contains example requests that show
98+
how to use the client.
99+
It's a great starting point if you're exploring the API for the first time or want to see full workflows in action.
100+
To start the demo, run
101+
102+
```bash
103+
cd demo
104+
python -m demo
105+
```
106+
107+
## 📚 Related Projects
108+
109+
### 🧠 [**Import/Export Client**](https://github.com/exxcellent/easyssp-import-export-client-python)
110+
111+
The official Python client for interacting with the easySSP Import/Export API.
112+
113+
### 🔐 [**Auth Client**](https://github.com/exxcellent/easyssp-auth-client-python)
114+
115+
Handles authentication by retrieving and storing JWT tokens.
116+
117+
### 🧰 [**Utils**](https://github.com/exxcellent/easyssp-python-clients-util)
118+
119+
A shared utility module used by all Python clients. Includes request handling, exceptions, and other reusable helpers.
120+
121+
---
122+
123+
## 🤝 Contributing
124+
125+
Spotted a bug or want to add your own scenario?
126+
Pull requests and issues are welcome!
127+
128+
## 📄 License
129+
130+
This project is licensed under the MIT License.

demo/demo.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from easyssp_auth import AuthError
2+
from easyssp_import_export.client.import_export_client import ImportExportClient
3+
from easyssp_utils.client import ApiException
4+
from pydantic import ValidationError
5+
6+
USER_AGENT = "easyssp-import-export-examples-python"
7+
8+
with (
9+
open("../input/ssp_example.ssp", "rb") as ssp_input_file,
10+
open("../output/ssp_output.ssp", "wb") as ssp_output_file,
11+
open("../input/ssd_example.ssd", "rb") as ssd_input_file,
12+
open("../output/ssd_output.ssp", "wb") as ssd_output_file,
13+
):
14+
try:
15+
import_export_client = ImportExportClient(username="your_easyssp_username", password="your_easyssp_password",
16+
user_agent=USER_AGENT)
17+
18+
# .ssp file import and export
19+
# import a .ssp file
20+
ssp_import_result = import_export_client.import_ssp(filename="ssp_import_example.ssp",
21+
body=ssp_input_file.read())
22+
# export it to .ssp file
23+
ssp_export_result = import_export_client.export_ssp(ssp_id=ssp_import_result.data.id)
24+
ssp_output_file.write(ssp_export_result.data) # write the exported file to the file system
25+
26+
# .ssd file import and export
27+
# import a .ssd file
28+
ssd_import_result = import_export_client.import_ssd(filename="ssd_import_example.ssd",
29+
body=ssd_input_file.read())
30+
# export it to .ssp file
31+
ssd_export_result = import_export_client.export_ssp(ssp_id=ssd_import_result.data.id)
32+
ssd_output_file.write(ssd_export_result.data) # write the exported file to the file system
33+
# catch ValidationError for incorrect request parameters
34+
# catch ApiException for errors from the API client or the server
35+
except (AuthError, ApiException, ValidationError) as ex:
36+
print(ex)

0 commit comments

Comments
 (0)