latitudesh-python-sdk 0.0.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of latitudesh-python-sdk might be problematic. Click here for more details.
- latitudesh_python_sdk/__init__.py +18 -0
- latitudesh_python_sdk/_hooks/__init__.py +5 -0
- latitudesh_python_sdk/_hooks/registration.py +13 -0
- latitudesh_python_sdk/_hooks/sdkhooks.py +76 -0
- latitudesh_python_sdk/_hooks/types.py +106 -0
- latitudesh_python_sdk/_version.py +15 -0
- latitudesh_python_sdk/apikeys.py +802 -0
- latitudesh_python_sdk/basesdk.py +366 -0
- latitudesh_python_sdk/billing.py +210 -0
- latitudesh_python_sdk/events_sdk.py +240 -0
- latitudesh_python_sdk/firewalls_sdk.py +1640 -0
- latitudesh_python_sdk/httpclient.py +136 -0
- latitudesh_python_sdk/ipaddresses_sdk.py +448 -0
- latitudesh_python_sdk/models/__init__.py +1927 -0
- latitudesh_python_sdk/models/api_key.py +81 -0
- latitudesh_python_sdk/models/apierror.py +22 -0
- latitudesh_python_sdk/models/assign_server_virtual_networkop.py +43 -0
- latitudesh_python_sdk/models/bandwidth_packages.py +67 -0
- latitudesh_python_sdk/models/bandwidth_plan.py +72 -0
- latitudesh_python_sdk/models/bandwidth_plans.py +15 -0
- latitudesh_python_sdk/models/billing_usage.py +158 -0
- latitudesh_python_sdk/models/create_api_key.py +40 -0
- latitudesh_python_sdk/models/create_firewall_assignmentop.py +61 -0
- latitudesh_python_sdk/models/create_firewallop.py +69 -0
- latitudesh_python_sdk/models/create_ipmi_sessionop.py +16 -0
- latitudesh_python_sdk/models/create_projectop.py +79 -0
- latitudesh_python_sdk/models/create_server_actionop.py +69 -0
- latitudesh_python_sdk/models/create_server_out_of_bandop.py +61 -0
- latitudesh_python_sdk/models/create_server_reinstallop.py +140 -0
- latitudesh_python_sdk/models/create_serverop.py +173 -0
- latitudesh_python_sdk/models/create_tagop.py +50 -0
- latitudesh_python_sdk/models/create_virtual_networkop.py +72 -0
- latitudesh_python_sdk/models/custom_tag.py +54 -0
- latitudesh_python_sdk/models/delete_api_keyop.py +16 -0
- latitudesh_python_sdk/models/delete_firewall_assignmentop.py +25 -0
- latitudesh_python_sdk/models/delete_firewallop.py +18 -0
- latitudesh_python_sdk/models/delete_project_ssh_keyop.py +23 -0
- latitudesh_python_sdk/models/delete_project_user_dataop.py +23 -0
- latitudesh_python_sdk/models/delete_projectop.py +18 -0
- latitudesh_python_sdk/models/delete_storage_filesystemsop.py +16 -0
- latitudesh_python_sdk/models/delete_virtual_networks_assignmentsop.py +16 -0
- latitudesh_python_sdk/models/delete_vpn_sessionop.py +16 -0
- latitudesh_python_sdk/models/deploy_config.py +74 -0
- latitudesh_python_sdk/models/destroy_serverop.py +31 -0
- latitudesh_python_sdk/models/destroy_tagop.py +16 -0
- latitudesh_python_sdk/models/destroy_team_memberop.py +18 -0
- latitudesh_python_sdk/models/destroy_virtual_machineop.py +16 -0
- latitudesh_python_sdk/models/destroy_virtual_networkop.py +18 -0
- latitudesh_python_sdk/models/error_object.py +49 -0
- latitudesh_python_sdk/models/events.py +90 -0
- latitudesh_python_sdk/models/filesystem_data.py +53 -0
- latitudesh_python_sdk/models/firewall.py +71 -0
- latitudesh_python_sdk/models/firewall_server.py +50 -0
- latitudesh_python_sdk/models/firewalls.py +26 -0
- latitudesh_python_sdk/models/get_bandwidth_plansop.py +33 -0
- latitudesh_python_sdk/models/get_billing_usageop.py +46 -0
- latitudesh_python_sdk/models/get_eventsop.py +98 -0
- latitudesh_python_sdk/models/get_firewall_assignmentsop.py +18 -0
- latitudesh_python_sdk/models/get_firewallop.py +18 -0
- latitudesh_python_sdk/models/get_ipop.py +33 -0
- latitudesh_python_sdk/models/get_ipsop.py +91 -0
- latitudesh_python_sdk/models/get_planop.py +16 -0
- latitudesh_python_sdk/models/get_plans_operating_systemop.py +19 -0
- latitudesh_python_sdk/models/get_plansop.py +125 -0
- latitudesh_python_sdk/models/get_project_ssh_keyop.py +37 -0
- latitudesh_python_sdk/models/get_project_ssh_keysop.py +33 -0
- latitudesh_python_sdk/models/get_project_user_dataop.py +38 -0
- latitudesh_python_sdk/models/get_project_users_dataop.py +46 -0
- latitudesh_python_sdk/models/get_projectsop.py +76 -0
- latitudesh_python_sdk/models/get_regionop.py +18 -0
- latitudesh_python_sdk/models/get_role_idop.py +16 -0
- latitudesh_python_sdk/models/get_rolesop.py +19 -0
- latitudesh_python_sdk/models/get_server_deploy_configop.py +18 -0
- latitudesh_python_sdk/models/get_server_out_of_bandop.py +18 -0
- latitudesh_python_sdk/models/get_serverop.py +33 -0
- latitudesh_python_sdk/models/get_serversop.py +156 -0
- latitudesh_python_sdk/models/get_storage_filesystemsop.py +22 -0
- latitudesh_python_sdk/models/get_traffic_consumptionop.py +45 -0
- latitudesh_python_sdk/models/get_traffic_quotaop.py +20 -0
- latitudesh_python_sdk/models/get_user_profileop.py +19 -0
- latitudesh_python_sdk/models/get_virtual_networkop.py +32 -0
- latitudesh_python_sdk/models/get_virtual_networks_assignmentsop.py +40 -0
- latitudesh_python_sdk/models/get_virtual_networksop.py +40 -0
- latitudesh_python_sdk/models/get_vpn_sessionsop.py +70 -0
- latitudesh_python_sdk/models/index_virtual_machineop.py +22 -0
- latitudesh_python_sdk/models/ip_address.py +122 -0
- latitudesh_python_sdk/models/ip_addresses.py +15 -0
- latitudesh_python_sdk/models/ipmi_session.py +53 -0
- latitudesh_python_sdk/models/list_firewallsop.py +20 -0
- latitudesh_python_sdk/models/membership.py +63 -0
- latitudesh_python_sdk/models/operating_systems.py +57 -0
- latitudesh_python_sdk/models/out_of_band_connection.py +88 -0
- latitudesh_python_sdk/models/patch_current_teamop.py +91 -0
- latitudesh_python_sdk/models/patch_storage_filesystemsop.py +79 -0
- latitudesh_python_sdk/models/patch_user_profileop.py +88 -0
- latitudesh_python_sdk/models/plan.py +15 -0
- latitudesh_python_sdk/models/plan_data.py +206 -0
- latitudesh_python_sdk/models/post_api_keyop.py +19 -0
- latitudesh_python_sdk/models/post_project_ssh_keyop.py +81 -0
- latitudesh_python_sdk/models/post_project_user_dataop.py +68 -0
- latitudesh_python_sdk/models/post_storage_filesystemsop.py +63 -0
- latitudesh_python_sdk/models/post_team_membersop.py +54 -0
- latitudesh_python_sdk/models/post_teamop.py +67 -0
- latitudesh_python_sdk/models/post_vpn_sessionop.py +63 -0
- latitudesh_python_sdk/models/project.py +130 -0
- latitudesh_python_sdk/models/project_include.py +72 -0
- latitudesh_python_sdk/models/projects.py +15 -0
- latitudesh_python_sdk/models/put_project_ssh_keyop.py +87 -0
- latitudesh_python_sdk/models/put_project_user_dataop.py +76 -0
- latitudesh_python_sdk/models/put_vpn_sessionop.py +16 -0
- latitudesh_python_sdk/models/region.py +50 -0
- latitudesh_python_sdk/models/region_resource_data.py +37 -0
- latitudesh_python_sdk/models/regions.py +50 -0
- latitudesh_python_sdk/models/role.py +15 -0
- latitudesh_python_sdk/models/role_data.py +35 -0
- latitudesh_python_sdk/models/security.py +25 -0
- latitudesh_python_sdk/models/server.py +54 -0
- latitudesh_python_sdk/models/server_action.py +52 -0
- latitudesh_python_sdk/models/server_data.py +219 -0
- latitudesh_python_sdk/models/server_exit_rescue_modeop.py +16 -0
- latitudesh_python_sdk/models/server_lockop.py +16 -0
- latitudesh_python_sdk/models/server_rescue.py +22 -0
- latitudesh_python_sdk/models/server_schedule_deletion.py +44 -0
- latitudesh_python_sdk/models/server_schedule_deletionop.py +16 -0
- latitudesh_python_sdk/models/server_start_rescue_modeop.py +16 -0
- latitudesh_python_sdk/models/server_unlockop.py +16 -0
- latitudesh_python_sdk/models/server_unschedule_deletionop.py +16 -0
- latitudesh_python_sdk/models/servers.py +26 -0
- latitudesh_python_sdk/models/show_virtual_machineop.py +16 -0
- latitudesh_python_sdk/models/ssh_key.py +15 -0
- latitudesh_python_sdk/models/ssh_key_data.py +55 -0
- latitudesh_python_sdk/models/storage_plan.py +36 -0
- latitudesh_python_sdk/models/storage_plans.py +15 -0
- latitudesh_python_sdk/models/team.py +74 -0
- latitudesh_python_sdk/models/team_include.py +43 -0
- latitudesh_python_sdk/models/team_members.py +51 -0
- latitudesh_python_sdk/models/teams.py +26 -0
- latitudesh_python_sdk/models/traffic.py +133 -0
- latitudesh_python_sdk/models/traffic_quota.py +106 -0
- latitudesh_python_sdk/models/update_api_key.py +48 -0
- latitudesh_python_sdk/models/update_api_keyop.py +41 -0
- latitudesh_python_sdk/models/update_firewallop.py +89 -0
- latitudesh_python_sdk/models/update_plans_bandwidthop.py +50 -0
- latitudesh_python_sdk/models/update_projectop.py +95 -0
- latitudesh_python_sdk/models/update_server_deploy_configop.py +122 -0
- latitudesh_python_sdk/models/update_serverop.py +69 -0
- latitudesh_python_sdk/models/update_tagop.py +74 -0
- latitudesh_python_sdk/models/update_virtual_networkop.py +67 -0
- latitudesh_python_sdk/models/user.py +59 -0
- latitudesh_python_sdk/models/user_data.py +15 -0
- latitudesh_python_sdk/models/user_data_properties.py +46 -0
- latitudesh_python_sdk/models/user_include.py +52 -0
- latitudesh_python_sdk/models/user_team.py +61 -0
- latitudesh_python_sdk/models/user_teams.py +26 -0
- latitudesh_python_sdk/models/user_update.py +37 -0
- latitudesh_python_sdk/models/virtual_machine.py +25 -0
- latitudesh_python_sdk/models/virtual_machine_payload.py +41 -0
- latitudesh_python_sdk/models/virtual_machine_plans.py +180 -0
- latitudesh_python_sdk/models/virtual_network.py +103 -0
- latitudesh_python_sdk/models/virtual_network1.py +84 -0
- latitudesh_python_sdk/models/virtual_network_assignment.py +37 -0
- latitudesh_python_sdk/models/virtual_network_assignments.py +29 -0
- latitudesh_python_sdk/models/virtual_networks.py +26 -0
- latitudesh_python_sdk/models/vpn_session_data_with_password.py +77 -0
- latitudesh_python_sdk/models/vpn_session_with_password.py +18 -0
- latitudesh_python_sdk/operatingsystems_sdk.py +188 -0
- latitudesh_python_sdk/plans.py +1178 -0
- latitudesh_python_sdk/privatenetworks.py +1672 -0
- latitudesh_python_sdk/projects_sdk.py +864 -0
- latitudesh_python_sdk/py.typed +1 -0
- latitudesh_python_sdk/regions_sdk.py +376 -0
- latitudesh_python_sdk/roles.py +374 -0
- latitudesh_python_sdk/sdk.py +214 -0
- latitudesh_python_sdk/sdkconfiguration.py +57 -0
- latitudesh_python_sdk/servers_sdk.py +3810 -0
- latitudesh_python_sdk/sshkeys.py +1050 -0
- latitudesh_python_sdk/storage.py +820 -0
- latitudesh_python_sdk/tags.py +786 -0
- latitudesh_python_sdk/teams_sdk.py +596 -0
- latitudesh_python_sdk/teamsmembers.py +578 -0
- latitudesh_python_sdk/traffic_sdk.py +400 -0
- latitudesh_python_sdk/types/__init__.py +21 -0
- latitudesh_python_sdk/types/basemodel.py +39 -0
- latitudesh_python_sdk/userdata_sdk.py +1052 -0
- latitudesh_python_sdk/userprofile.py +596 -0
- latitudesh_python_sdk/utils/__init__.py +101 -0
- latitudesh_python_sdk/utils/annotations.py +55 -0
- latitudesh_python_sdk/utils/enums.py +34 -0
- latitudesh_python_sdk/utils/eventstreaming.py +238 -0
- latitudesh_python_sdk/utils/forms.py +202 -0
- latitudesh_python_sdk/utils/headers.py +136 -0
- latitudesh_python_sdk/utils/logger.py +27 -0
- latitudesh_python_sdk/utils/metadata.py +118 -0
- latitudesh_python_sdk/utils/queryparams.py +205 -0
- latitudesh_python_sdk/utils/requestbodies.py +66 -0
- latitudesh_python_sdk/utils/retries.py +217 -0
- latitudesh_python_sdk/utils/security.py +192 -0
- latitudesh_python_sdk/utils/serializers.py +219 -0
- latitudesh_python_sdk/utils/url.py +155 -0
- latitudesh_python_sdk/utils/values.py +137 -0
- latitudesh_python_sdk/virtualmachines.py +772 -0
- latitudesh_python_sdk/vpnsessions.py +818 -0
- latitudesh_python_sdk-0.0.6.dist-info/LICENSE +21 -0
- latitudesh_python_sdk-0.0.6.dist-info/METADATA +730 -0
- latitudesh_python_sdk-0.0.6.dist-info/RECORD +206 -0
- latitudesh_python_sdk-0.0.6.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,730 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: latitudesh-python-sdk
|
|
3
|
+
Version: 0.0.6
|
|
4
|
+
Summary: Python Client SDK Generated by Speakeasy.
|
|
5
|
+
Author: Speakeasy
|
|
6
|
+
Requires-Python: >=3.9
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Requires-Dist: eval-type-backport (>=0.2.0)
|
|
14
|
+
Requires-Dist: httpx (>=0.28.1)
|
|
15
|
+
Requires-Dist: pydantic (>=2.10.3)
|
|
16
|
+
Requires-Dist: python-dateutil (>=2.8.2)
|
|
17
|
+
Requires-Dist: typing-inspection (>=0.4.0)
|
|
18
|
+
Project-URL: Repository, https://github.com/latitudesh/latitudesh-python-sdk.git
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
|
|
21
|
+
# latitudesh-python-sdk
|
|
22
|
+
|
|
23
|
+
Developer-friendly & type-safe Python SDK specifically catered to leverage *latitudesh-python-sdk* API.
|
|
24
|
+
|
|
25
|
+
<div align="left">
|
|
26
|
+
<a href="https://www.speakeasy.com/?utm_source=latitudesh-python-sdk&utm_campaign=python"><img src="https://custom-icon-badges.demolab.com/badge/-Built%20By%20Speakeasy-212015?style=for-the-badge&logoColor=FBE331&logo=speakeasy&labelColor=545454" /></a>
|
|
27
|
+
<a href="https://opensource.org/licenses/MIT">
|
|
28
|
+
<img src="https://img.shields.io/badge/License-MIT-blue.svg" style="width: 100px; height: 28px;" />
|
|
29
|
+
</a>
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
<!-- Start Summary [summary] -->
|
|
34
|
+
## Summary
|
|
35
|
+
|
|
36
|
+
Latitude.sh API: The Latitude.sh API is a RESTful API to manage your Latitude.sh account. It allows you to perform the same actions as the Latitude.sh dashboard.
|
|
37
|
+
<!-- End Summary [summary] -->
|
|
38
|
+
|
|
39
|
+
<!-- Start Table of Contents [toc] -->
|
|
40
|
+
## Table of Contents
|
|
41
|
+
<!-- $toc-max-depth=2 -->
|
|
42
|
+
* [latitudesh-python-sdk](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/#latitudesh-python-sdk)
|
|
43
|
+
* [SDK Installation](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/#sdk-installation)
|
|
44
|
+
* [IDE Support](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/#ide-support)
|
|
45
|
+
* [SDK Example Usage](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/#sdk-example-usage)
|
|
46
|
+
* [Authentication](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/#authentication)
|
|
47
|
+
* [Available Resources and Operations](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/#available-resources-and-operations)
|
|
48
|
+
* [Retries](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/#retries)
|
|
49
|
+
* [Error Handling](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/#error-handling)
|
|
50
|
+
* [Server Selection](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/#server-selection)
|
|
51
|
+
* [Custom HTTP Client](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/#custom-http-client)
|
|
52
|
+
* [Resource Management](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/#resource-management)
|
|
53
|
+
* [Debugging](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/#debugging)
|
|
54
|
+
* [Development](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/#development)
|
|
55
|
+
* [Maturity](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/#maturity)
|
|
56
|
+
* [Contributions](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/#contributions)
|
|
57
|
+
|
|
58
|
+
<!-- End Table of Contents [toc] -->
|
|
59
|
+
|
|
60
|
+
> [!NOTE]
|
|
61
|
+
> **Python version upgrade policy**
|
|
62
|
+
>
|
|
63
|
+
> Once a Python version reaches its [official end of life date](https://devguide.python.org/versions/), a 3-month grace period is provided for users to upgrade. Following this grace period, the minimum python version supported in the SDK will be updated.
|
|
64
|
+
|
|
65
|
+
The SDK can be installed with either *pip* or *poetry* package managers.
|
|
66
|
+
|
|
67
|
+
### PIP
|
|
68
|
+
|
|
69
|
+
*PIP* is the default package installer for Python, enabling easy installation and management of packages from PyPI via the command line.
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pip install git+https://github.com/latitudesh/latitudesh-python-sdk.git
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Poetry
|
|
76
|
+
|
|
77
|
+
*Poetry* is a modern tool that simplifies dependency management and package publishing by using a single `pyproject.toml` file to handle project metadata and dependencies.
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
poetry add git+https://github.com/latitudesh/latitudesh-python-sdk.git
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Shell and script usage with `uv`
|
|
84
|
+
|
|
85
|
+
You can use this SDK in a Python shell with [uv](https://docs.astral.sh/uv/) and the `uvx` command that comes with it like so:
|
|
86
|
+
|
|
87
|
+
```shell
|
|
88
|
+
uvx --from latitudesh-python-sdk python
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
It's also possible to write a standalone Python script without needing to set up a whole project like so:
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
#!/usr/bin/env -S uv run --script
|
|
95
|
+
# /// script
|
|
96
|
+
# requires-python = ">=3.9"
|
|
97
|
+
# dependencies = [
|
|
98
|
+
# "latitudesh-python-sdk",
|
|
99
|
+
# ]
|
|
100
|
+
# ///
|
|
101
|
+
|
|
102
|
+
from latitudesh_python_sdk import Latitudesh
|
|
103
|
+
|
|
104
|
+
sdk = Latitudesh(
|
|
105
|
+
# SDK arguments
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
# Rest of script here...
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Once that is saved to a file, you can run it with `uv run script.py` where
|
|
112
|
+
`script.py` can be replaced with the actual file name.
|
|
113
|
+
<!-- End SDK Installation [installation] -->
|
|
114
|
+
|
|
115
|
+
<!-- Start SDK Installation [installation] -->
|
|
116
|
+
## SDK Installation
|
|
117
|
+
|
|
118
|
+
> [!TIP]
|
|
119
|
+
> To finish publishing your SDK to PyPI you must [run your first generation action](https://www.speakeasy.com/docs/github-setup#step-by-step-guide).
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
> [!NOTE]
|
|
123
|
+
> **Python version upgrade policy**
|
|
124
|
+
>
|
|
125
|
+
> Once a Python version reaches its [official end of life date](https://devguide.python.org/versions/), a 3-month grace period is provided for users to upgrade. Following this grace period, the minimum python version supported in the SDK will be updated.
|
|
126
|
+
|
|
127
|
+
The SDK can be installed with either *pip* or *poetry* package managers.
|
|
128
|
+
|
|
129
|
+
### PIP
|
|
130
|
+
|
|
131
|
+
*PIP* is the default package installer for Python, enabling easy installation and management of packages from PyPI via the command line.
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
pip install git+https://github.com/latitudesh/latitudesh-python-sdk.git
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Poetry
|
|
138
|
+
|
|
139
|
+
*Poetry* is a modern tool that simplifies dependency management and package publishing by using a single `pyproject.toml` file to handle project metadata and dependencies.
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
poetry add git+https://github.com/latitudesh/latitudesh-python-sdk.git
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Shell and script usage with `uv`
|
|
146
|
+
|
|
147
|
+
You can use this SDK in a Python shell with [uv](https://docs.astral.sh/uv/) and the `uvx` command that comes with it like so:
|
|
148
|
+
|
|
149
|
+
```shell
|
|
150
|
+
uvx --from latitudesh-python-sdk python
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
It's also possible to write a standalone Python script without needing to set up a whole project like so:
|
|
154
|
+
|
|
155
|
+
```python
|
|
156
|
+
#!/usr/bin/env -S uv run --script
|
|
157
|
+
# /// script
|
|
158
|
+
# requires-python = ">=3.9"
|
|
159
|
+
# dependencies = [
|
|
160
|
+
# "latitudesh-python-sdk",
|
|
161
|
+
# ]
|
|
162
|
+
# ///
|
|
163
|
+
|
|
164
|
+
from latitudesh_python_sdk import Latitudesh
|
|
165
|
+
|
|
166
|
+
sdk = Latitudesh(
|
|
167
|
+
# SDK arguments
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
# Rest of script here...
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Once that is saved to a file, you can run it with `uv run script.py` where
|
|
174
|
+
`script.py` can be replaced with the actual file name.
|
|
175
|
+
<!-- End SDK Installation [installation] -->
|
|
176
|
+
|
|
177
|
+
<!-- Start IDE Support [idesupport] -->
|
|
178
|
+
## IDE Support
|
|
179
|
+
|
|
180
|
+
### PyCharm
|
|
181
|
+
|
|
182
|
+
Generally, the SDK will work well with most IDEs out of the box. However, when using PyCharm, you can enjoy much better integration with Pydantic by installing an additional plugin.
|
|
183
|
+
|
|
184
|
+
- [PyCharm Pydantic Plugin](https://docs.pydantic.dev/latest/integrations/pycharm/)
|
|
185
|
+
<!-- End IDE Support [idesupport] -->
|
|
186
|
+
|
|
187
|
+
<!-- Start SDK Example Usage [usage] -->
|
|
188
|
+
## SDK Example Usage
|
|
189
|
+
|
|
190
|
+
### Example
|
|
191
|
+
|
|
192
|
+
```python
|
|
193
|
+
# Synchronous Example
|
|
194
|
+
from latitudesh_python_sdk import Latitudesh
|
|
195
|
+
import os
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
with Latitudesh(
|
|
199
|
+
bearer=os.getenv("LATITUDESH_BEARER", ""),
|
|
200
|
+
) as latitudesh:
|
|
201
|
+
|
|
202
|
+
res = latitudesh.api_keys.list()
|
|
203
|
+
|
|
204
|
+
# Handle response
|
|
205
|
+
print(res)
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
</br>
|
|
209
|
+
|
|
210
|
+
The same SDK client can also be used to make asychronous requests by importing asyncio.
|
|
211
|
+
```python
|
|
212
|
+
# Asynchronous Example
|
|
213
|
+
import asyncio
|
|
214
|
+
from latitudesh_python_sdk import Latitudesh
|
|
215
|
+
import os
|
|
216
|
+
|
|
217
|
+
async def main():
|
|
218
|
+
|
|
219
|
+
async with Latitudesh(
|
|
220
|
+
bearer=os.getenv("LATITUDESH_BEARER", ""),
|
|
221
|
+
) as latitudesh:
|
|
222
|
+
|
|
223
|
+
res = await latitudesh.api_keys.list_async()
|
|
224
|
+
|
|
225
|
+
# Handle response
|
|
226
|
+
print(res)
|
|
227
|
+
|
|
228
|
+
asyncio.run(main())
|
|
229
|
+
```
|
|
230
|
+
<!-- End SDK Example Usage [usage] -->
|
|
231
|
+
|
|
232
|
+
<!-- Start Authentication [security] -->
|
|
233
|
+
## Authentication
|
|
234
|
+
|
|
235
|
+
### Per-Client Security Schemes
|
|
236
|
+
|
|
237
|
+
This SDK supports the following security scheme globally:
|
|
238
|
+
|
|
239
|
+
| Name | Type | Scheme | Environment Variable |
|
|
240
|
+
| -------- | ------ | ------- | -------------------- |
|
|
241
|
+
| `bearer` | apiKey | API key | `LATITUDESH_BEARER` |
|
|
242
|
+
|
|
243
|
+
To authenticate with the API the `bearer` parameter must be set when initializing the SDK client instance. For example:
|
|
244
|
+
```python
|
|
245
|
+
from latitudesh_python_sdk import Latitudesh
|
|
246
|
+
import os
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
with Latitudesh(
|
|
250
|
+
bearer=os.getenv("LATITUDESH_BEARER", ""),
|
|
251
|
+
) as latitudesh:
|
|
252
|
+
|
|
253
|
+
res = latitudesh.api_keys.list()
|
|
254
|
+
|
|
255
|
+
# Handle response
|
|
256
|
+
print(res)
|
|
257
|
+
|
|
258
|
+
```
|
|
259
|
+
<!-- End Authentication [security] -->
|
|
260
|
+
|
|
261
|
+
<!-- Start Available Resources and Operations [operations] -->
|
|
262
|
+
## Available Resources and Operations
|
|
263
|
+
|
|
264
|
+
<details open>
|
|
265
|
+
<summary>Available methods</summary>
|
|
266
|
+
|
|
267
|
+
### [api_keys](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/apikeys/README.md)
|
|
268
|
+
|
|
269
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/apikeys/README.md#list) - List API Keys
|
|
270
|
+
* [create](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/apikeys/README.md#create) - Create API Key
|
|
271
|
+
* [regenerate](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/apikeys/README.md#regenerate) - Regenerate API Key
|
|
272
|
+
* [delete](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/apikeys/README.md#delete) - Delete API Key
|
|
273
|
+
|
|
274
|
+
### [billing](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/billing/README.md)
|
|
275
|
+
|
|
276
|
+
* [list_usage](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/billing/README.md#list_usage) - List Billing Usage
|
|
277
|
+
|
|
278
|
+
### [events](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/eventssdk/README.md)
|
|
279
|
+
|
|
280
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/eventssdk/README.md#list) - List all Events
|
|
281
|
+
|
|
282
|
+
### [firewalls](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/firewallssdk/README.md)
|
|
283
|
+
|
|
284
|
+
* [create](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/firewallssdk/README.md#create) - Create a firewall
|
|
285
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/firewallssdk/README.md#list) - List firewalls
|
|
286
|
+
* [get](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/firewallssdk/README.md#get) - Retrieve Firewall
|
|
287
|
+
* [update](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/firewallssdk/README.md#update) - Update Firewall
|
|
288
|
+
* [delete](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/firewallssdk/README.md#delete) - Delete Firewall
|
|
289
|
+
* [assign](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/firewallssdk/README.md#assign) - Firewall Assignment
|
|
290
|
+
* [list_assignments](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/firewallssdk/README.md#list_assignments) - Firewall Assignments
|
|
291
|
+
* [delete_assignment](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/firewallssdk/README.md#delete_assignment) - Delete Firewall Assignment
|
|
292
|
+
|
|
293
|
+
### [ip_addresses](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/ipaddressessdk/README.md)
|
|
294
|
+
|
|
295
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/ipaddressessdk/README.md#list) - List IPs
|
|
296
|
+
* [get](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/ipaddressessdk/README.md#get) - Retrieve an IP
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
### [operating_systems](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/operatingsystemssdk/README.md)
|
|
300
|
+
|
|
301
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/operatingsystemssdk/README.md#list) - List all operating systems available
|
|
302
|
+
|
|
303
|
+
### [plans](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/plans/README.md)
|
|
304
|
+
|
|
305
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/plans/README.md#list) - List all Plans
|
|
306
|
+
* [get](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/plans/README.md#get) - Retrieve a Plan
|
|
307
|
+
* [list_bandwidth](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/plans/README.md#list_bandwidth) - List all bandwidth plans
|
|
308
|
+
* [update_bandwidth](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/plans/README.md#update_bandwidth) - Buy or remove bandwidth packages
|
|
309
|
+
* [list_storage](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/plans/README.md#list_storage) - List all Storage Plans
|
|
310
|
+
* [list_vm_plans](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/plans/README.md#list_vm_plans) - List all Virtual Machines Plans
|
|
311
|
+
|
|
312
|
+
### [private_networks](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/privatenetworks/README.md)
|
|
313
|
+
|
|
314
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/privatenetworks/README.md#list) - List all Virtual Networks
|
|
315
|
+
* [create](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/privatenetworks/README.md#create) - Create a Virtual Network
|
|
316
|
+
* [update](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/privatenetworks/README.md#update) - Update a Virtual Network
|
|
317
|
+
* [delete_virtual_network](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/privatenetworks/README.md#delete_virtual_network) - Delete a Virtual Network
|
|
318
|
+
* [get](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/privatenetworks/README.md#get) - Retrieve a Virtual Network
|
|
319
|
+
* [list_assignments](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/privatenetworks/README.md#list_assignments) - List all servers assigned to virtual networks
|
|
320
|
+
* [assign](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/privatenetworks/README.md#assign) - Assign Virtual network
|
|
321
|
+
* [remove_assignment](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/privatenetworks/README.md#remove_assignment) - Delete Virtual Network Assignment
|
|
322
|
+
|
|
323
|
+
### [projects](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/projectssdk/README.md)
|
|
324
|
+
|
|
325
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/projectssdk/README.md#list) - List all Projects
|
|
326
|
+
* [create](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/projectssdk/README.md#create) - Create a Project
|
|
327
|
+
* [update](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/projectssdk/README.md#update) - Update a Project
|
|
328
|
+
* [delete](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/projectssdk/README.md#delete) - Delete a Project
|
|
329
|
+
|
|
330
|
+
### [regions](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/regionssdk/README.md)
|
|
331
|
+
|
|
332
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/regionssdk/README.md#list) - List all Regions
|
|
333
|
+
* [get](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/regionssdk/README.md#get) - Retrieve a Region
|
|
334
|
+
|
|
335
|
+
### [roles](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/roles/README.md)
|
|
336
|
+
|
|
337
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/roles/README.md#list) - List all Roles
|
|
338
|
+
* [get](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/roles/README.md#get) - Retrieve Role
|
|
339
|
+
|
|
340
|
+
### [servers](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md)
|
|
341
|
+
|
|
342
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#list) - List all Servers
|
|
343
|
+
* [create](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#create) - Deploy Server
|
|
344
|
+
* [get](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#get) - Retrieve a Server
|
|
345
|
+
* [update](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#update) - Update Server
|
|
346
|
+
* [delete](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#delete) - Remove Server
|
|
347
|
+
* [get_deploy_config](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#get_deploy_config) - Retrieve Deploy Config
|
|
348
|
+
* [update_deploy_config](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#update_deploy_config) - Update Deploy Config
|
|
349
|
+
* [lock](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#lock) - Lock the server
|
|
350
|
+
* [unlock](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#unlock) - Unlock the server
|
|
351
|
+
* [create_out_of_band_connection](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#create_out_of_band_connection) - Start Out of Band Connection
|
|
352
|
+
* [list_out_of_band_connections](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#list_out_of_band_connections) - List Out of Band Connections
|
|
353
|
+
* [actions](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#actions) - Run Server Action
|
|
354
|
+
* [create_ipmi_session](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#create_ipmi_session) - Generate IPMI credentials
|
|
355
|
+
* [start_rescue_mode](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#start_rescue_mode) - Puts a Server in rescue mode
|
|
356
|
+
* [exit_rescue_mode](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#exit_rescue_mode) - Exits rescue mode for a Server
|
|
357
|
+
* [schedule_deletion](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#schedule_deletion) - Schedule the server deletion
|
|
358
|
+
* [unschedule_deletion](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#unschedule_deletion) - Unschedule the server deletion
|
|
359
|
+
* [reinstall](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#reinstall) - Run Server Reinstall
|
|
360
|
+
|
|
361
|
+
### [ssh_keys](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/sshkeys/README.md)
|
|
362
|
+
|
|
363
|
+
* [list_for_project](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/sshkeys/README.md#list_for_project) - List all Project SSH Keys
|
|
364
|
+
* [create](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/sshkeys/README.md#create) - Create a Project SSH Key
|
|
365
|
+
* [get](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/sshkeys/README.md#get) - Retrieve a Project SSH Key
|
|
366
|
+
* [update](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/sshkeys/README.md#update) - Update a Project SSH Key
|
|
367
|
+
* [delete](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/sshkeys/README.md#delete) - Delete a Project SSH Key
|
|
368
|
+
|
|
369
|
+
### [storage](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/storage/README.md)
|
|
370
|
+
|
|
371
|
+
* [create_filesystem](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/storage/README.md#create_filesystem) - Create a filesystem for a project
|
|
372
|
+
* [list_filesystems](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/storage/README.md#list_filesystems) - List filesystems
|
|
373
|
+
* [delete_filesystem](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/storage/README.md#delete_filesystem) - Delete a filesystem for a project
|
|
374
|
+
* [update_filesystem](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/storage/README.md#update_filesystem) - Update a filesystem for a project
|
|
375
|
+
|
|
376
|
+
### [tags](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/tags/README.md)
|
|
377
|
+
|
|
378
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/tags/README.md#list) - List all Tags
|
|
379
|
+
* [create](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/tags/README.md#create) - Create a Tag
|
|
380
|
+
* [update](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/tags/README.md#update) - Update Tag
|
|
381
|
+
* [delete](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/tags/README.md#delete) - Delete Tag
|
|
382
|
+
|
|
383
|
+
### [teams](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/teamssdk/README.md)
|
|
384
|
+
|
|
385
|
+
* [get](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/teamssdk/README.md#get) - Retrieve the team
|
|
386
|
+
* [create](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/teamssdk/README.md#create) - Create a team
|
|
387
|
+
* [update](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/teamssdk/README.md#update) - Update a team
|
|
388
|
+
|
|
389
|
+
### [teams_members](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/teamsmembers/README.md)
|
|
390
|
+
|
|
391
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/teamsmembers/README.md#list) - List all Team Members
|
|
392
|
+
* [add](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/teamsmembers/README.md#add) - Add a Team Member
|
|
393
|
+
* [remove_member](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/teamsmembers/README.md#remove_member) - Remove a Team Member
|
|
394
|
+
|
|
395
|
+
### [traffic](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/trafficsdk/README.md)
|
|
396
|
+
|
|
397
|
+
* [get](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/trafficsdk/README.md#get) - Retrieve Traffic consumption
|
|
398
|
+
* [get_quota](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/trafficsdk/README.md#get_quota) - Retrieve Traffic Quota
|
|
399
|
+
|
|
400
|
+
### [user_data](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/userdatasdk/README.md)
|
|
401
|
+
|
|
402
|
+
* [list_project_user_data](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/userdatasdk/README.md#list_project_user_data) - List all Project User Data
|
|
403
|
+
* [create](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/userdatasdk/README.md#create) - Create a Project User Data
|
|
404
|
+
* [get_project_user_data](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/userdatasdk/README.md#get_project_user_data) - Retrieve a Project User Data
|
|
405
|
+
* [update](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/userdatasdk/README.md#update) - Update a Project User Data
|
|
406
|
+
* [delete](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/userdatasdk/README.md#delete) - Delete a Project User Data
|
|
407
|
+
|
|
408
|
+
### [user_profile](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/userprofile/README.md)
|
|
409
|
+
|
|
410
|
+
* [get](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/userprofile/README.md#get) - Get user profile
|
|
411
|
+
* [update](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/userprofile/README.md#update) - Update User Profile
|
|
412
|
+
* [list_teams](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/userprofile/README.md#list_teams) - List User Teams
|
|
413
|
+
|
|
414
|
+
### [virtual_machines](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/virtualmachines/README.md)
|
|
415
|
+
|
|
416
|
+
* [create](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/virtualmachines/README.md#create) - Create a Virtual Machine
|
|
417
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/virtualmachines/README.md#list) - Get Teams Virtual Machines
|
|
418
|
+
* [get](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/virtualmachines/README.md#get) - Get a Virtual Machine
|
|
419
|
+
* [delete](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/virtualmachines/README.md#delete) - Destroy a Virtual Machine
|
|
420
|
+
|
|
421
|
+
### [vpn_sessions](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/vpnsessions/README.md)
|
|
422
|
+
|
|
423
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/vpnsessions/README.md#list) - List all Active VPN Sessions
|
|
424
|
+
* [create](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/vpnsessions/README.md#create) - Create a VPN Session
|
|
425
|
+
* [refresh_password](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/vpnsessions/README.md#refresh_password) - Refresh a VPN Session
|
|
426
|
+
* [delete](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/vpnsessions/README.md#delete) - Delete a VPN Session
|
|
427
|
+
|
|
428
|
+
</details>
|
|
429
|
+
<!-- End Available Resources and Operations [operations] -->
|
|
430
|
+
|
|
431
|
+
<!-- Start Retries [retries] -->
|
|
432
|
+
## Retries
|
|
433
|
+
|
|
434
|
+
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
|
|
435
|
+
|
|
436
|
+
To change the default retry strategy for a single API call, simply provide a `RetryConfig` object to the call:
|
|
437
|
+
```python
|
|
438
|
+
from latitudesh_python_sdk import Latitudesh
|
|
439
|
+
from latitudesh_python_sdk.utils import BackoffStrategy, RetryConfig
|
|
440
|
+
import os
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
with Latitudesh(
|
|
444
|
+
bearer=os.getenv("LATITUDESH_BEARER", ""),
|
|
445
|
+
) as latitudesh:
|
|
446
|
+
|
|
447
|
+
res = latitudesh.api_keys.list(,
|
|
448
|
+
RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
|
|
449
|
+
|
|
450
|
+
# Handle response
|
|
451
|
+
print(res)
|
|
452
|
+
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
If you'd like to override the default retry strategy for all operations that support retries, you can use the `retry_config` optional parameter when initializing the SDK:
|
|
456
|
+
```python
|
|
457
|
+
from latitudesh_python_sdk import Latitudesh
|
|
458
|
+
from latitudesh_python_sdk.utils import BackoffStrategy, RetryConfig
|
|
459
|
+
import os
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
with Latitudesh(
|
|
463
|
+
retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False),
|
|
464
|
+
bearer=os.getenv("LATITUDESH_BEARER", ""),
|
|
465
|
+
) as latitudesh:
|
|
466
|
+
|
|
467
|
+
res = latitudesh.api_keys.list()
|
|
468
|
+
|
|
469
|
+
# Handle response
|
|
470
|
+
print(res)
|
|
471
|
+
|
|
472
|
+
```
|
|
473
|
+
<!-- End Retries [retries] -->
|
|
474
|
+
|
|
475
|
+
<!-- Start Error Handling [errors] -->
|
|
476
|
+
## Error Handling
|
|
477
|
+
|
|
478
|
+
Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an exception.
|
|
479
|
+
|
|
480
|
+
By default, an API error will raise a models.APIError exception, which has the following properties:
|
|
481
|
+
|
|
482
|
+
| Property | Type | Description |
|
|
483
|
+
|-----------------|------------------|-----------------------|
|
|
484
|
+
| `.status_code` | *int* | The HTTP status code |
|
|
485
|
+
| `.message` | *str* | The error message |
|
|
486
|
+
| `.raw_response` | *httpx.Response* | The raw HTTP response |
|
|
487
|
+
| `.body` | *str* | The response content |
|
|
488
|
+
|
|
489
|
+
When custom error responses are specified for an operation, the SDK may also raise their associated exceptions. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `create_async` method may raise the following exceptions:
|
|
490
|
+
|
|
491
|
+
| Error Type | Status Code | Content Type |
|
|
492
|
+
| ------------------ | ----------- | ------------------------ |
|
|
493
|
+
| models.ErrorObject | 400, 422 | application/vnd.api+json |
|
|
494
|
+
| models.APIError | 4XX, 5XX | \*/\* |
|
|
495
|
+
|
|
496
|
+
### Example
|
|
497
|
+
|
|
498
|
+
```python
|
|
499
|
+
import latitudesh_python_sdk
|
|
500
|
+
from latitudesh_python_sdk import Latitudesh, models
|
|
501
|
+
import os
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
with Latitudesh(
|
|
505
|
+
bearer=os.getenv("LATITUDESH_BEARER", ""),
|
|
506
|
+
) as latitudesh:
|
|
507
|
+
res = None
|
|
508
|
+
try:
|
|
509
|
+
|
|
510
|
+
res = latitudesh.api_keys.create(request={
|
|
511
|
+
"data": {
|
|
512
|
+
"type": latitudesh_python_sdk.CreateAPIKeyType.API_KEYS,
|
|
513
|
+
"attributes": {},
|
|
514
|
+
},
|
|
515
|
+
})
|
|
516
|
+
|
|
517
|
+
# Handle response
|
|
518
|
+
print(res)
|
|
519
|
+
|
|
520
|
+
except models.ErrorObject as e:
|
|
521
|
+
# handle e.data: models.ErrorObjectData
|
|
522
|
+
raise(e)
|
|
523
|
+
except models.APIError as e:
|
|
524
|
+
# handle exception
|
|
525
|
+
raise(e)
|
|
526
|
+
```
|
|
527
|
+
<!-- End Error Handling [errors] -->
|
|
528
|
+
|
|
529
|
+
<!-- Start Server Selection [server] -->
|
|
530
|
+
## Server Selection
|
|
531
|
+
|
|
532
|
+
### Select Server by Index
|
|
533
|
+
|
|
534
|
+
You can override the default server globally by passing a server index to the `server_idx: int` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
|
|
535
|
+
|
|
536
|
+
| # | Server | Variables | Description |
|
|
537
|
+
| --- | ------------------------- | ------------------ | ----------- |
|
|
538
|
+
| 0 | `https://api.latitude.sh` | `latitude_api_key` | |
|
|
539
|
+
| 1 | `http://api.latitude.sh` | `latitude_api_key` | |
|
|
540
|
+
|
|
541
|
+
If the selected server has variables, you may override its default values through the additional parameters made available in the SDK constructor:
|
|
542
|
+
|
|
543
|
+
| Variable | Parameter | Default | Description |
|
|
544
|
+
| ------------------ | ----------------------- | ------------------------------ | ----------- |
|
|
545
|
+
| `latitude_api_key` | `latitude_api_key: str` | `"<insert your api key here>"` | |
|
|
546
|
+
|
|
547
|
+
#### Example
|
|
548
|
+
|
|
549
|
+
```python
|
|
550
|
+
from latitudesh_python_sdk import Latitudesh
|
|
551
|
+
import os
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
with Latitudesh(
|
|
555
|
+
server_idx=1,
|
|
556
|
+
latitude_api_key="<value>"
|
|
557
|
+
bearer=os.getenv("LATITUDESH_BEARER", ""),
|
|
558
|
+
) as latitudesh:
|
|
559
|
+
|
|
560
|
+
res = latitudesh.api_keys.list()
|
|
561
|
+
|
|
562
|
+
# Handle response
|
|
563
|
+
print(res)
|
|
564
|
+
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
### Override Server URL Per-Client
|
|
568
|
+
|
|
569
|
+
The default server can also be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example:
|
|
570
|
+
```python
|
|
571
|
+
from latitudesh_python_sdk import Latitudesh
|
|
572
|
+
import os
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
with Latitudesh(
|
|
576
|
+
server_url="https://api.latitude.sh",
|
|
577
|
+
bearer=os.getenv("LATITUDESH_BEARER", ""),
|
|
578
|
+
) as latitudesh:
|
|
579
|
+
|
|
580
|
+
res = latitudesh.api_keys.list()
|
|
581
|
+
|
|
582
|
+
# Handle response
|
|
583
|
+
print(res)
|
|
584
|
+
|
|
585
|
+
```
|
|
586
|
+
<!-- End Server Selection [server] -->
|
|
587
|
+
|
|
588
|
+
<!-- Start Custom HTTP Client [http-client] -->
|
|
589
|
+
## Custom HTTP Client
|
|
590
|
+
|
|
591
|
+
The Python SDK makes API calls using the [httpx](https://www.python-httpx.org/) HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with your own HTTP client instance.
|
|
592
|
+
Depending on whether you are using the sync or async version of the SDK, you can pass an instance of `HttpClient` or `AsyncHttpClient` respectively, which are Protocol's ensuring that the client has the necessary methods to make API calls.
|
|
593
|
+
This allows you to wrap the client with your own custom logic, such as adding custom headers, logging, or error handling, or you can just pass an instance of `httpx.Client` or `httpx.AsyncClient` directly.
|
|
594
|
+
|
|
595
|
+
For example, you could specify a header for every request that this sdk makes as follows:
|
|
596
|
+
```python
|
|
597
|
+
from latitudesh_python_sdk import Latitudesh
|
|
598
|
+
import httpx
|
|
599
|
+
|
|
600
|
+
http_client = httpx.Client(headers={"x-custom-header": "someValue"})
|
|
601
|
+
s = Latitudesh(client=http_client)
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
or you could wrap the client with your own custom logic:
|
|
605
|
+
```python
|
|
606
|
+
from latitudesh_python_sdk import Latitudesh
|
|
607
|
+
from latitudesh_python_sdk.httpclient import AsyncHttpClient
|
|
608
|
+
import httpx
|
|
609
|
+
|
|
610
|
+
class CustomClient(AsyncHttpClient):
|
|
611
|
+
client: AsyncHttpClient
|
|
612
|
+
|
|
613
|
+
def __init__(self, client: AsyncHttpClient):
|
|
614
|
+
self.client = client
|
|
615
|
+
|
|
616
|
+
async def send(
|
|
617
|
+
self,
|
|
618
|
+
request: httpx.Request,
|
|
619
|
+
*,
|
|
620
|
+
stream: bool = False,
|
|
621
|
+
auth: Union[
|
|
622
|
+
httpx._types.AuthTypes, httpx._client.UseClientDefault, None
|
|
623
|
+
] = httpx.USE_CLIENT_DEFAULT,
|
|
624
|
+
follow_redirects: Union[
|
|
625
|
+
bool, httpx._client.UseClientDefault
|
|
626
|
+
] = httpx.USE_CLIENT_DEFAULT,
|
|
627
|
+
) -> httpx.Response:
|
|
628
|
+
request.headers["Client-Level-Header"] = "added by client"
|
|
629
|
+
|
|
630
|
+
return await self.client.send(
|
|
631
|
+
request, stream=stream, auth=auth, follow_redirects=follow_redirects
|
|
632
|
+
)
|
|
633
|
+
|
|
634
|
+
def build_request(
|
|
635
|
+
self,
|
|
636
|
+
method: str,
|
|
637
|
+
url: httpx._types.URLTypes,
|
|
638
|
+
*,
|
|
639
|
+
content: Optional[httpx._types.RequestContent] = None,
|
|
640
|
+
data: Optional[httpx._types.RequestData] = None,
|
|
641
|
+
files: Optional[httpx._types.RequestFiles] = None,
|
|
642
|
+
json: Optional[Any] = None,
|
|
643
|
+
params: Optional[httpx._types.QueryParamTypes] = None,
|
|
644
|
+
headers: Optional[httpx._types.HeaderTypes] = None,
|
|
645
|
+
cookies: Optional[httpx._types.CookieTypes] = None,
|
|
646
|
+
timeout: Union[
|
|
647
|
+
httpx._types.TimeoutTypes, httpx._client.UseClientDefault
|
|
648
|
+
] = httpx.USE_CLIENT_DEFAULT,
|
|
649
|
+
extensions: Optional[httpx._types.RequestExtensions] = None,
|
|
650
|
+
) -> httpx.Request:
|
|
651
|
+
return self.client.build_request(
|
|
652
|
+
method,
|
|
653
|
+
url,
|
|
654
|
+
content=content,
|
|
655
|
+
data=data,
|
|
656
|
+
files=files,
|
|
657
|
+
json=json,
|
|
658
|
+
params=params,
|
|
659
|
+
headers=headers,
|
|
660
|
+
cookies=cookies,
|
|
661
|
+
timeout=timeout,
|
|
662
|
+
extensions=extensions,
|
|
663
|
+
)
|
|
664
|
+
|
|
665
|
+
s = Latitudesh(async_client=CustomClient(httpx.AsyncClient()))
|
|
666
|
+
```
|
|
667
|
+
<!-- End Custom HTTP Client [http-client] -->
|
|
668
|
+
|
|
669
|
+
<!-- Start Resource Management [resource-management] -->
|
|
670
|
+
## Resource Management
|
|
671
|
+
|
|
672
|
+
The `Latitudesh` class implements the context manager protocol and registers a finalizer function to close the underlying sync and async HTTPX clients it uses under the hood. This will close HTTP connections, release memory and free up other resources held by the SDK. In short-lived Python programs and notebooks that make a few SDK method calls, resource management may not be a concern. However, in longer-lived programs, it is beneficial to create a single SDK instance via a [context manager][context-manager] and reuse it across the application.
|
|
673
|
+
|
|
674
|
+
[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers
|
|
675
|
+
|
|
676
|
+
```python
|
|
677
|
+
from latitudesh_python_sdk import Latitudesh
|
|
678
|
+
import os
|
|
679
|
+
def main():
|
|
680
|
+
|
|
681
|
+
with Latitudesh(
|
|
682
|
+
bearer=os.getenv("LATITUDESH_BEARER", ""),
|
|
683
|
+
) as latitudesh:
|
|
684
|
+
# Rest of application here...
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
# Or when using async:
|
|
688
|
+
async def amain():
|
|
689
|
+
|
|
690
|
+
async with Latitudesh(
|
|
691
|
+
bearer=os.getenv("LATITUDESH_BEARER", ""),
|
|
692
|
+
) as latitudesh:
|
|
693
|
+
# Rest of application here...
|
|
694
|
+
```
|
|
695
|
+
<!-- End Resource Management [resource-management] -->
|
|
696
|
+
|
|
697
|
+
<!-- Start Debugging [debug] -->
|
|
698
|
+
## Debugging
|
|
699
|
+
|
|
700
|
+
You can setup your SDK to emit debug logs for SDK requests and responses.
|
|
701
|
+
|
|
702
|
+
You can pass your own logger class directly into your SDK.
|
|
703
|
+
```python
|
|
704
|
+
from latitudesh_python_sdk import Latitudesh
|
|
705
|
+
import logging
|
|
706
|
+
|
|
707
|
+
logging.basicConfig(level=logging.DEBUG)
|
|
708
|
+
s = Latitudesh(debug_logger=logging.getLogger("latitudesh_python_sdk"))
|
|
709
|
+
```
|
|
710
|
+
|
|
711
|
+
You can also enable a default debug logger by setting an environment variable `LATITUDESH_DEBUG` to true.
|
|
712
|
+
<!-- End Debugging [debug] -->
|
|
713
|
+
|
|
714
|
+
<!-- Placeholder for Future Speakeasy SDK Sections -->
|
|
715
|
+
|
|
716
|
+
# Development
|
|
717
|
+
|
|
718
|
+
## Maturity
|
|
719
|
+
|
|
720
|
+
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
|
|
721
|
+
to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
|
|
722
|
+
looking for the latest version.
|
|
723
|
+
|
|
724
|
+
## Contributions
|
|
725
|
+
|
|
726
|
+
While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation.
|
|
727
|
+
We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.
|
|
728
|
+
|
|
729
|
+
### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=latitudesh-python-sdk&utm_campaign=python)
|
|
730
|
+
|