latitudesh-python-sdk 2.3.0__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.
- 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 +113 -0
- latitudesh_python_sdk/_version.py +17 -0
- latitudesh_python_sdk/apikeys.py +703 -0
- latitudesh_python_sdk/basesdk.py +374 -0
- latitudesh_python_sdk/billing.py +197 -0
- latitudesh_python_sdk/events_sdk.py +298 -0
- latitudesh_python_sdk/firewalls_sdk.py +1786 -0
- latitudesh_python_sdk/httpclient.py +125 -0
- latitudesh_python_sdk/ipaddresses_sdk.py +470 -0
- latitudesh_python_sdk/models/__init__.py +3581 -0
- latitudesh_python_sdk/models/api_key.py +81 -0
- latitudesh_python_sdk/models/apierror.py +40 -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_data.py +72 -0
- latitudesh_python_sdk/models/bandwidth_plans.py +26 -0
- latitudesh_python_sdk/models/billing_usage.py +249 -0
- latitudesh_python_sdk/models/container_plan_data.py +163 -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 +73 -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_machine_actionop.py +63 -0
- latitudesh_python_sdk/models/create_virtual_networkop.py +72 -0
- latitudesh_python_sdk/models/custom_tag.py +26 -0
- latitudesh_python_sdk/models/custom_tag_data.py +54 -0
- latitudesh_python_sdk/models/custom_tags.py +26 -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_ssh_keyop.py +16 -0
- latitudesh_python_sdk/models/delete_storage_filesystemsop.py +16 -0
- latitudesh_python_sdk/models/delete_storage_volumesop.py +16 -0
- latitudesh_python_sdk/models/delete_user_dataop.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 +62 -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/event_data.py +98 -0
- latitudesh_python_sdk/models/events.py +26 -0
- latitudesh_python_sdk/models/filesystem_data.py +57 -0
- latitudesh_python_sdk/models/firewall.py +26 -0
- latitudesh_python_sdk/models/firewall_assignment_data.py +50 -0
- latitudesh_python_sdk/models/firewall_assignments.py +29 -0
- latitudesh_python_sdk/models/firewall_data.py +75 -0
- latitudesh_python_sdk/models/firewall_server.py +36 -0
- latitudesh_python_sdk/models/firewalls.py +26 -0
- latitudesh_python_sdk/models/get_all_firewall_assignmentsop.py +51 -0
- latitudesh_python_sdk/models/get_bandwidth_plansop.py +62 -0
- latitudesh_python_sdk/models/get_billing_usageop.py +46 -0
- latitudesh_python_sdk/models/get_containers_planop.py +18 -0
- latitudesh_python_sdk/models/get_eventsop.py +126 -0
- latitudesh_python_sdk/models/get_firewall_assignmentsop.py +53 -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 +120 -0
- latitudesh_python_sdk/models/get_planop.py +16 -0
- latitudesh_python_sdk/models/get_plans_operating_systemop.py +54 -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 +105 -0
- latitudesh_python_sdk/models/get_regionop.py +18 -0
- latitudesh_python_sdk/models/get_regionsop.py +42 -0
- latitudesh_python_sdk/models/get_role_idop.py +16 -0
- latitudesh_python_sdk/models/get_rolesop.py +54 -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 +185 -0
- latitudesh_python_sdk/models/get_ssh_keyop.py +30 -0
- latitudesh_python_sdk/models/get_ssh_keysop.py +31 -0
- latitudesh_python_sdk/models/get_storage_filesystemsop.py +22 -0
- latitudesh_python_sdk/models/get_storage_volumeop.py +32 -0
- latitudesh_python_sdk/models/get_storage_volumesop.py +35 -0
- latitudesh_python_sdk/models/get_team_membersop.py +42 -0
- latitudesh_python_sdk/models/get_traffic_consumptionop.py +49 -0
- latitudesh_python_sdk/models/get_traffic_quotaop.py +20 -0
- latitudesh_python_sdk/models/get_user_dataop.py +31 -0
- latitudesh_python_sdk/models/get_user_profileop.py +19 -0
- latitudesh_python_sdk/models/get_users_dataop.py +44 -0
- latitudesh_python_sdk/models/get_virtual_networkop.py +32 -0
- latitudesh_python_sdk/models/get_virtual_networks_assignmentsop.py +72 -0
- latitudesh_python_sdk/models/get_virtual_networksop.py +69 -0
- latitudesh_python_sdk/models/get_vpn_sessionsop.py +70 -0
- latitudesh_python_sdk/models/index_virtual_machineop.py +31 -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/latitudesherror.py +30 -0
- latitudesh_python_sdk/models/list_firewallsop.py +49 -0
- latitudesh_python_sdk/models/membership.py +63 -0
- latitudesh_python_sdk/models/no_response_error.py +17 -0
- latitudesh_python_sdk/models/operating_system_data.py +65 -0
- latitudesh_python_sdk/models/operating_systems.py +26 -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_dataop.py +69 -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 +210 -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_ssh_keyop.py +63 -0
- latitudesh_python_sdk/models/post_storage_filesystemsop.py +63 -0
- latitudesh_python_sdk/models/post_storage_volumes_mountop.py +62 -0
- latitudesh_python_sdk/models/post_storage_volumesop.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_user_dataop.py +50 -0
- latitudesh_python_sdk/models/post_vpn_sessionop.py +63 -0
- latitudesh_python_sdk/models/project.py +131 -0
- latitudesh_python_sdk/models/project_include.py +75 -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_ssh_keyop.py +80 -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/responsevalidationerror.py +27 -0
- latitudesh_python_sdk/models/role.py +26 -0
- latitudesh_python_sdk/models/role_data.py +35 -0
- latitudesh_python_sdk/models/security.py +25 -0
- latitudesh_python_sdk/models/server.py +26 -0
- latitudesh_python_sdk/models/server_action.py +52 -0
- latitudesh_python_sdk/models/server_data.py +280 -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_region_resource_data.py +40 -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_data.py +55 -0
- latitudesh_python_sdk/models/ssh_keys.py +26 -0
- latitudesh_python_sdk/models/storage_plan_data.py +47 -0
- latitudesh_python_sdk/models/storage_plans.py +26 -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 +85 -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 +26 -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 +29 -0
- latitudesh_python_sdk/models/virtual_machine_attributes.py +115 -0
- latitudesh_python_sdk/models/virtual_machine_payload.py +47 -0
- latitudesh_python_sdk/models/virtual_machine_plans.py +181 -0
- latitudesh_python_sdk/models/virtual_network.py +26 -0
- latitudesh_python_sdk/models/virtual_network_assignment.py +29 -0
- latitudesh_python_sdk/models/virtual_network_assignment_data.py +65 -0
- latitudesh_python_sdk/models/virtual_network_assignments.py +29 -0
- latitudesh_python_sdk/models/virtual_network_data.py +114 -0
- latitudesh_python_sdk/models/virtual_networks.py +26 -0
- latitudesh_python_sdk/models/volume_data.py +111 -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 +238 -0
- latitudesh_python_sdk/plans.py +1304 -0
- latitudesh_python_sdk/privatenetworks.py +1612 -0
- latitudesh_python_sdk/projects_sdk.py +830 -0
- latitudesh_python_sdk/py.typed +1 -0
- latitudesh_python_sdk/regions_sdk.py +398 -0
- latitudesh_python_sdk/roles.py +398 -0
- latitudesh_python_sdk/sdk.py +264 -0
- latitudesh_python_sdk/sdkconfiguration.py +50 -0
- latitudesh_python_sdk/servers_sdk.py +3414 -0
- latitudesh_python_sdk/sshkeys_sdk.py +1882 -0
- latitudesh_python_sdk/storage.py +1651 -0
- latitudesh_python_sdk/tags.py +715 -0
- latitudesh_python_sdk/teams_sdk.py +527 -0
- latitudesh_python_sdk/teamsmembers.py +576 -0
- latitudesh_python_sdk/traffic_sdk.py +357 -0
- latitudesh_python_sdk/types/__init__.py +21 -0
- latitudesh_python_sdk/types/basemodel.py +39 -0
- latitudesh_python_sdk/userdata_sdk.py +1888 -0
- latitudesh_python_sdk/userprofile.py +531 -0
- latitudesh_python_sdk/utils/__init__.py +200 -0
- latitudesh_python_sdk/utils/annotations.py +79 -0
- latitudesh_python_sdk/utils/datetimes.py +23 -0
- latitudesh_python_sdk/utils/enums.py +74 -0
- latitudesh_python_sdk/utils/eventstreaming.py +248 -0
- latitudesh_python_sdk/utils/forms.py +234 -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 +217 -0
- latitudesh_python_sdk/utils/requestbodies.py +66 -0
- latitudesh_python_sdk/utils/retries.py +281 -0
- latitudesh_python_sdk/utils/security.py +192 -0
- latitudesh_python_sdk/utils/serializers.py +249 -0
- latitudesh_python_sdk/utils/unmarshal_json_response.py +38 -0
- latitudesh_python_sdk/utils/url.py +155 -0
- latitudesh_python_sdk/utils/values.py +137 -0
- latitudesh_python_sdk/virtualmachines.py +941 -0
- latitudesh_python_sdk/vpnsessions.py +715 -0
- latitudesh_python_sdk-2.3.0.dist-info/METADATA +787 -0
- latitudesh_python_sdk-2.3.0.dist-info/RECORD +242 -0
- latitudesh_python_sdk-2.3.0.dist-info/WHEEL +4 -0
- latitudesh_python_sdk-2.3.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,787 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: latitudesh-python-sdk
|
|
3
|
+
Version: 2.3.0
|
|
4
|
+
Summary: Python Client SDK Generated by Speakeasy.
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Author: Speakeasy
|
|
7
|
+
Requires-Python: >=3.9.2
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
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
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
14
|
+
Requires-Dist: httpcore (>=1.0.9)
|
|
15
|
+
Requires-Dist: httpx (>=0.28.1)
|
|
16
|
+
Requires-Dist: jsonpath-python (>=1.0.6)
|
|
17
|
+
Requires-Dist: pydantic (>=2.11.2)
|
|
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
|
+
* [Pagination](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/#pagination)
|
|
49
|
+
* [Retries](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/#retries)
|
|
50
|
+
* [Error Handling](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/#error-handling)
|
|
51
|
+
* [Server Selection](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/#server-selection)
|
|
52
|
+
* [Custom HTTP Client](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/#custom-http-client)
|
|
53
|
+
* [Resource Management](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/#resource-management)
|
|
54
|
+
* [Debugging](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/#debugging)
|
|
55
|
+
* [Development](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/#development)
|
|
56
|
+
* [Maturity](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/#maturity)
|
|
57
|
+
* [Contributions](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/#contributions)
|
|
58
|
+
|
|
59
|
+
<!-- End Table of Contents [toc] -->
|
|
60
|
+
|
|
61
|
+
> [!NOTE]
|
|
62
|
+
> **Python version upgrade policy**
|
|
63
|
+
>
|
|
64
|
+
> 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.
|
|
65
|
+
|
|
66
|
+
The SDK can be installed with either *pip* or *poetry* package managers.
|
|
67
|
+
|
|
68
|
+
### PIP
|
|
69
|
+
|
|
70
|
+
*PIP* is the default package installer for Python, enabling easy installation and management of packages from PyPI via the command line.
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
pip install git+https://github.com/latitudesh/latitudesh-python-sdk.git
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Poetry
|
|
77
|
+
|
|
78
|
+
*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.
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
poetry add git+https://github.com/latitudesh/latitudesh-python-sdk.git
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Shell and script usage with `uv`
|
|
85
|
+
|
|
86
|
+
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:
|
|
87
|
+
|
|
88
|
+
```shell
|
|
89
|
+
uvx --from latitudesh-python-sdk python
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
It's also possible to write a standalone Python script without needing to set up a whole project like so:
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
#!/usr/bin/env -S uv run --script
|
|
96
|
+
# /// script
|
|
97
|
+
# requires-python = ">=3.9"
|
|
98
|
+
# dependencies = [
|
|
99
|
+
# "latitudesh-python-sdk",
|
|
100
|
+
# ]
|
|
101
|
+
# ///
|
|
102
|
+
|
|
103
|
+
from latitudesh_python_sdk import Latitudesh
|
|
104
|
+
|
|
105
|
+
sdk = Latitudesh(
|
|
106
|
+
# SDK arguments
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
# Rest of script here...
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Once that is saved to a file, you can run it with `uv run script.py` where
|
|
113
|
+
`script.py` can be replaced with the actual file name.
|
|
114
|
+
<!-- End SDK Installation [installation] -->
|
|
115
|
+
|
|
116
|
+
<!-- Start SDK Installation [installation] -->
|
|
117
|
+
## SDK Installation
|
|
118
|
+
|
|
119
|
+
> [!NOTE]
|
|
120
|
+
> **Python version upgrade policy**
|
|
121
|
+
>
|
|
122
|
+
> 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.
|
|
123
|
+
|
|
124
|
+
The SDK can be installed with *uv*, *pip*, or *poetry* package managers.
|
|
125
|
+
|
|
126
|
+
### uv
|
|
127
|
+
|
|
128
|
+
*uv* is a fast Python package installer and resolver, designed as a drop-in replacement for pip and pip-tools. It's recommended for its speed and modern Python tooling capabilities.
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
uv add latitudesh-python-sdk
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### PIP
|
|
135
|
+
|
|
136
|
+
*PIP* is the default package installer for Python, enabling easy installation and management of packages from PyPI via the command line.
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
pip install latitudesh-python-sdk
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Poetry
|
|
143
|
+
|
|
144
|
+
*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.
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
poetry add latitudesh-python-sdk
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Shell and script usage with `uv`
|
|
151
|
+
|
|
152
|
+
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:
|
|
153
|
+
|
|
154
|
+
```shell
|
|
155
|
+
uvx --from latitudesh-python-sdk python
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
It's also possible to write a standalone Python script without needing to set up a whole project like so:
|
|
159
|
+
|
|
160
|
+
```python
|
|
161
|
+
#!/usr/bin/env -S uv run --script
|
|
162
|
+
# /// script
|
|
163
|
+
# requires-python = ">=3.9"
|
|
164
|
+
# dependencies = [
|
|
165
|
+
# "latitudesh-python-sdk",
|
|
166
|
+
# ]
|
|
167
|
+
# ///
|
|
168
|
+
|
|
169
|
+
from latitudesh_python_sdk import Latitudesh
|
|
170
|
+
|
|
171
|
+
sdk = Latitudesh(
|
|
172
|
+
# SDK arguments
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
# Rest of script here...
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Once that is saved to a file, you can run it with `uv run script.py` where
|
|
179
|
+
`script.py` can be replaced with the actual file name.
|
|
180
|
+
<!-- End SDK Installation [installation] -->
|
|
181
|
+
|
|
182
|
+
<!-- Start IDE Support [idesupport] -->
|
|
183
|
+
## IDE Support
|
|
184
|
+
|
|
185
|
+
### PyCharm
|
|
186
|
+
|
|
187
|
+
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.
|
|
188
|
+
|
|
189
|
+
- [PyCharm Pydantic Plugin](https://docs.pydantic.dev/latest/integrations/pycharm/)
|
|
190
|
+
<!-- End IDE Support [idesupport] -->
|
|
191
|
+
|
|
192
|
+
<!-- Start SDK Example Usage [usage] -->
|
|
193
|
+
## SDK Example Usage
|
|
194
|
+
|
|
195
|
+
### Example
|
|
196
|
+
|
|
197
|
+
```python
|
|
198
|
+
# Synchronous Example
|
|
199
|
+
from latitudesh_python_sdk import Latitudesh
|
|
200
|
+
import os
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
with Latitudesh(
|
|
204
|
+
bearer=os.getenv("LATITUDESH_BEARER", ""),
|
|
205
|
+
) as latitudesh:
|
|
206
|
+
|
|
207
|
+
res = latitudesh.api_keys.list()
|
|
208
|
+
|
|
209
|
+
# Handle response
|
|
210
|
+
print(res)
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
</br>
|
|
214
|
+
|
|
215
|
+
The same SDK client can also be used to make asynchronous requests by importing asyncio.
|
|
216
|
+
|
|
217
|
+
```python
|
|
218
|
+
# Asynchronous Example
|
|
219
|
+
import asyncio
|
|
220
|
+
from latitudesh_python_sdk import Latitudesh
|
|
221
|
+
import os
|
|
222
|
+
|
|
223
|
+
async def main():
|
|
224
|
+
|
|
225
|
+
async with Latitudesh(
|
|
226
|
+
bearer=os.getenv("LATITUDESH_BEARER", ""),
|
|
227
|
+
) as latitudesh:
|
|
228
|
+
|
|
229
|
+
res = await latitudesh.api_keys.list_async()
|
|
230
|
+
|
|
231
|
+
# Handle response
|
|
232
|
+
print(res)
|
|
233
|
+
|
|
234
|
+
asyncio.run(main())
|
|
235
|
+
```
|
|
236
|
+
<!-- End SDK Example Usage [usage] -->
|
|
237
|
+
|
|
238
|
+
<!-- Start Authentication [security] -->
|
|
239
|
+
## Authentication
|
|
240
|
+
|
|
241
|
+
### Per-Client Security Schemes
|
|
242
|
+
|
|
243
|
+
This SDK supports the following security scheme globally:
|
|
244
|
+
|
|
245
|
+
| Name | Type | Scheme | Environment Variable |
|
|
246
|
+
| -------- | ------ | ------- | -------------------- |
|
|
247
|
+
| `bearer` | apiKey | API key | `LATITUDESH_BEARER` |
|
|
248
|
+
|
|
249
|
+
To authenticate with the API the `bearer` parameter must be set when initializing the SDK client instance. For example:
|
|
250
|
+
```python
|
|
251
|
+
from latitudesh_python_sdk import Latitudesh
|
|
252
|
+
import os
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
with Latitudesh(
|
|
256
|
+
bearer=os.getenv("LATITUDESH_BEARER", ""),
|
|
257
|
+
) as latitudesh:
|
|
258
|
+
|
|
259
|
+
res = latitudesh.api_keys.list()
|
|
260
|
+
|
|
261
|
+
# Handle response
|
|
262
|
+
print(res)
|
|
263
|
+
|
|
264
|
+
```
|
|
265
|
+
<!-- End Authentication [security] -->
|
|
266
|
+
|
|
267
|
+
<!-- Start Available Resources and Operations [operations] -->
|
|
268
|
+
## Available Resources and Operations
|
|
269
|
+
|
|
270
|
+
<details open>
|
|
271
|
+
<summary>Available methods</summary>
|
|
272
|
+
|
|
273
|
+
### [api_keys](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/apikeys/README.md)
|
|
274
|
+
|
|
275
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/apikeys/README.md#list) - List API Keys
|
|
276
|
+
* [create](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/apikeys/README.md#create) - Create API Key
|
|
277
|
+
* [regenerate](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/apikeys/README.md#regenerate) - Regenerate API Key
|
|
278
|
+
* [delete](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/apikeys/README.md#delete) - Delete API Key
|
|
279
|
+
|
|
280
|
+
### [billing](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/billing/README.md)
|
|
281
|
+
|
|
282
|
+
* [list_usage](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/billing/README.md#list_usage) - List Billing Usage
|
|
283
|
+
|
|
284
|
+
### [events](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/eventssdk/README.md)
|
|
285
|
+
|
|
286
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/eventssdk/README.md#list) - List all Events
|
|
287
|
+
|
|
288
|
+
### [firewalls](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/firewallssdk/README.md)
|
|
289
|
+
|
|
290
|
+
* [get_all_firewall_assignments](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/firewallssdk/README.md#get_all_firewall_assignments) - List All Firewall Assignments
|
|
291
|
+
* [create](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/firewallssdk/README.md#create) - Create a firewall
|
|
292
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/firewallssdk/README.md#list) - List firewalls
|
|
293
|
+
* [get](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/firewallssdk/README.md#get) - Retrieve Firewall
|
|
294
|
+
* [update](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/firewallssdk/README.md#update) - Update Firewall
|
|
295
|
+
* [delete](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/firewallssdk/README.md#delete) - Delete Firewall
|
|
296
|
+
* [assign](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/firewallssdk/README.md#assign) - Firewall Assignment
|
|
297
|
+
* [list_assignments](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/firewallssdk/README.md#list_assignments) - Firewall Assignments
|
|
298
|
+
* [delete_assignment](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/firewallssdk/README.md#delete_assignment) - Delete Firewall Assignment
|
|
299
|
+
|
|
300
|
+
### [ip_addresses](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/ipaddressessdk/README.md)
|
|
301
|
+
|
|
302
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/ipaddressessdk/README.md#list) - List IPs
|
|
303
|
+
* [get](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/ipaddressessdk/README.md#get) - Retrieve an IP
|
|
304
|
+
|
|
305
|
+
### [operating_systems](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/operatingsystemssdk/README.md)
|
|
306
|
+
|
|
307
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/operatingsystemssdk/README.md#list) - List all operating systems available
|
|
308
|
+
|
|
309
|
+
### [plans](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/plans/README.md)
|
|
310
|
+
|
|
311
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/plans/README.md#list) - List all Plans
|
|
312
|
+
* [get](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/plans/README.md#get) - Retrieve a Plan
|
|
313
|
+
* [list_bandwidth](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/plans/README.md#list_bandwidth) - List all bandwidth plans
|
|
314
|
+
* [update_bandwidth](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/plans/README.md#update_bandwidth) - Buy or remove bandwidth packages
|
|
315
|
+
* [get_containers_plan](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/plans/README.md#get_containers_plan) - Retrieve container plan
|
|
316
|
+
* [list_storage](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/plans/README.md#list_storage) - List all Storage Plans
|
|
317
|
+
* [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
|
|
318
|
+
|
|
319
|
+
### [private_networks](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/privatenetworks/README.md)
|
|
320
|
+
|
|
321
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/privatenetworks/README.md#list) - List all Virtual Networks
|
|
322
|
+
* [create](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/privatenetworks/README.md#create) - Create a Virtual Network
|
|
323
|
+
* [update](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/privatenetworks/README.md#update) - Update a Virtual Network
|
|
324
|
+
* [delete_virtual_network](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/privatenetworks/README.md#delete_virtual_network) - Delete a Virtual Network
|
|
325
|
+
* [get](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/privatenetworks/README.md#get) - Retrieve a Virtual Network
|
|
326
|
+
* [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
|
|
327
|
+
* [assign](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/privatenetworks/README.md#assign) - Assign Virtual network
|
|
328
|
+
* [remove_assignment](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/privatenetworks/README.md#remove_assignment) - Delete Virtual Network Assignment
|
|
329
|
+
|
|
330
|
+
### [projects](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/projectssdk/README.md)
|
|
331
|
+
|
|
332
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/projectssdk/README.md#list) - List all Projects
|
|
333
|
+
* [create](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/projectssdk/README.md#create) - Create a Project
|
|
334
|
+
* [update](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/projectssdk/README.md#update) - Update a Project
|
|
335
|
+
* [delete](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/projectssdk/README.md#delete) - Delete a Project
|
|
336
|
+
|
|
337
|
+
### [regions](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/regionssdk/README.md)
|
|
338
|
+
|
|
339
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/regionssdk/README.md#list) - List all Regions
|
|
340
|
+
* [get](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/regionssdk/README.md#get) - Retrieve a Region
|
|
341
|
+
|
|
342
|
+
### [roles](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/roles/README.md)
|
|
343
|
+
|
|
344
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/roles/README.md#list) - List all Roles
|
|
345
|
+
* [get](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/roles/README.md#get) - Retrieve Role
|
|
346
|
+
|
|
347
|
+
### [servers](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md)
|
|
348
|
+
|
|
349
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#list) - List all Servers
|
|
350
|
+
* [create](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#create) - Deploy Server
|
|
351
|
+
* [get](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#get) - Retrieve a Server
|
|
352
|
+
* [update](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#update) - Update Server
|
|
353
|
+
* [delete](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#delete) - Remove Server
|
|
354
|
+
* [get_deploy_config](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#get_deploy_config) - Retrieve Deploy Config
|
|
355
|
+
* [update_deploy_config](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#update_deploy_config) - Update Deploy Config
|
|
356
|
+
* [lock](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#lock) - Lock the server
|
|
357
|
+
* [unlock](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#unlock) - Unlock the server
|
|
358
|
+
* [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
|
|
359
|
+
* [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
|
|
360
|
+
* [actions](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#actions) - Run Server Action
|
|
361
|
+
* [create_ipmi_session](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#create_ipmi_session) - Generate IPMI credentials
|
|
362
|
+
* [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
|
|
363
|
+
* [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
|
|
364
|
+
* [schedule_deletion](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#schedule_deletion) - Schedule the server deletion
|
|
365
|
+
* [unschedule_deletion](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#unschedule_deletion) - Unschedule the server deletion
|
|
366
|
+
* [reinstall](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/serverssdk/README.md#reinstall) - Run Server Reinstall
|
|
367
|
+
|
|
368
|
+
### [ssh_keys](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/sshkeyssdk/README.md)
|
|
369
|
+
|
|
370
|
+
* [~~list_for_project~~](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/sshkeyssdk/README.md#list_for_project) - List all Project SSH Keys :warning: **Deprecated**
|
|
371
|
+
* [~~create~~](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/sshkeyssdk/README.md#create) - Create a Project SSH Key :warning: **Deprecated**
|
|
372
|
+
* [~~get~~](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/sshkeyssdk/README.md#get) - Retrieve a Project SSH Key :warning: **Deprecated**
|
|
373
|
+
* [~~update~~](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/sshkeyssdk/README.md#update) - Update a Project SSH Key :warning: **Deprecated**
|
|
374
|
+
* [~~delete~~](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/sshkeyssdk/README.md#delete) - Delete a Project SSH Key :warning: **Deprecated**
|
|
375
|
+
* [get_ssh_keys](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/sshkeyssdk/README.md#get_ssh_keys) - List all SSH Keys
|
|
376
|
+
* [post_ssh_key](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/sshkeyssdk/README.md#post_ssh_key) - Create a SSH Key
|
|
377
|
+
* [get_ssh_key](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/sshkeyssdk/README.md#get_ssh_key) - Retrieve a SSH Key
|
|
378
|
+
* [put_ssh_key](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/sshkeyssdk/README.md#put_ssh_key) - Update a SSH Key
|
|
379
|
+
* [delete_ssh_key](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/sshkeyssdk/README.md#delete_ssh_key) - Delete a SSH Key
|
|
380
|
+
|
|
381
|
+
### [storage](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/storage/README.md)
|
|
382
|
+
|
|
383
|
+
* [create_filesystem](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/storage/README.md#create_filesystem) - Create a filesystem for a project
|
|
384
|
+
* [list_filesystems](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/storage/README.md#list_filesystems) - List filesystems
|
|
385
|
+
* [delete_filesystem](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/storage/README.md#delete_filesystem) - Delete a filesystem for a project
|
|
386
|
+
* [update_filesystem](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/storage/README.md#update_filesystem) - Update a filesystem for a project
|
|
387
|
+
* [post_storage_volumes](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/storage/README.md#post_storage_volumes) - Create volume
|
|
388
|
+
* [get_storage_volumes](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/storage/README.md#get_storage_volumes) - List volumes
|
|
389
|
+
* [delete_storage_volumes](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/storage/README.md#delete_storage_volumes) - Delete volume
|
|
390
|
+
* [get_storage_volume](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/storage/README.md#get_storage_volume) - Get volume
|
|
391
|
+
* [post_storage_volumes_mount](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/storage/README.md#post_storage_volumes_mount) - Mount volume
|
|
392
|
+
|
|
393
|
+
### [tags](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/tags/README.md)
|
|
394
|
+
|
|
395
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/tags/README.md#list) - List all Tags
|
|
396
|
+
* [create](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/tags/README.md#create) - Create a Tag
|
|
397
|
+
* [update](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/tags/README.md#update) - Update Tag
|
|
398
|
+
* [delete](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/tags/README.md#delete) - Delete Tag
|
|
399
|
+
|
|
400
|
+
### [teams](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/teamssdk/README.md)
|
|
401
|
+
|
|
402
|
+
* [get](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/teamssdk/README.md#get) - Retrieve the team
|
|
403
|
+
* [create](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/teamssdk/README.md#create) - Create a team
|
|
404
|
+
* [update](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/teamssdk/README.md#update) - Update a team
|
|
405
|
+
|
|
406
|
+
### [teams_members](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/teamsmembers/README.md)
|
|
407
|
+
|
|
408
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/teamsmembers/README.md#list) - List all Team Members
|
|
409
|
+
* [add](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/teamsmembers/README.md#add) - Add a Team Member
|
|
410
|
+
* [remove_member](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/teamsmembers/README.md#remove_member) - Remove a Team Member
|
|
411
|
+
|
|
412
|
+
### [traffic](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/trafficsdk/README.md)
|
|
413
|
+
|
|
414
|
+
* [get](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/trafficsdk/README.md#get) - Retrieve Traffic consumption
|
|
415
|
+
* [get_quota](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/trafficsdk/README.md#get_quota) - Retrieve Traffic Quota
|
|
416
|
+
|
|
417
|
+
### [user_data](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/userdatasdk/README.md)
|
|
418
|
+
|
|
419
|
+
* [~~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 :warning: **Deprecated**
|
|
420
|
+
* [~~create~~](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/userdatasdk/README.md#create) - Create a Project User Data :warning: **Deprecated**
|
|
421
|
+
* [~~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 :warning: **Deprecated**
|
|
422
|
+
* [~~update~~](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/userdatasdk/README.md#update) - Update a Project User Data :warning: **Deprecated**
|
|
423
|
+
* [~~delete~~](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/userdatasdk/README.md#delete) - Delete a Project User Data :warning: **Deprecated**
|
|
424
|
+
* [get_users_data](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/userdatasdk/README.md#get_users_data) - List all User Data
|
|
425
|
+
* [post_user_data](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/userdatasdk/README.md#post_user_data) - Create an User Data
|
|
426
|
+
* [get_user_data](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/userdatasdk/README.md#get_user_data) - Retrieve an User Data
|
|
427
|
+
* [patch_user_data](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/userdatasdk/README.md#patch_user_data) - Update an User Data
|
|
428
|
+
* [delete_user_data](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/userdatasdk/README.md#delete_user_data) - Delete an User Data
|
|
429
|
+
|
|
430
|
+
### [user_profile](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/userprofile/README.md)
|
|
431
|
+
|
|
432
|
+
* [get](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/userprofile/README.md#get) - Get user profile
|
|
433
|
+
* [update](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/userprofile/README.md#update) - Update User Profile
|
|
434
|
+
* [list_teams](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/userprofile/README.md#list_teams) - List User Teams
|
|
435
|
+
|
|
436
|
+
### [virtual_machines](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/virtualmachines/README.md)
|
|
437
|
+
|
|
438
|
+
* [create](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/virtualmachines/README.md#create) - Create a Virtual Machine
|
|
439
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/virtualmachines/README.md#list) - Get Teams Virtual Machines
|
|
440
|
+
* [get](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/virtualmachines/README.md#get) - Get a Virtual Machine
|
|
441
|
+
* [delete](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/virtualmachines/README.md#delete) - Destroy a Virtual Machine
|
|
442
|
+
* [create_virtual_machine_action](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/virtualmachines/README.md#create_virtual_machine_action) - Run Virtual Machine Action
|
|
443
|
+
|
|
444
|
+
### [vpn_sessions](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/vpnsessions/README.md)
|
|
445
|
+
|
|
446
|
+
* [list](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/vpnsessions/README.md#list) - List all Active VPN Sessions
|
|
447
|
+
* [create](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/vpnsessions/README.md#create) - Create a VPN Session
|
|
448
|
+
* [refresh_password](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/vpnsessions/README.md#refresh_password) - Refresh a VPN Session
|
|
449
|
+
* [delete](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/docs/sdks/vpnsessions/README.md#delete) - Delete a VPN Session
|
|
450
|
+
|
|
451
|
+
</details>
|
|
452
|
+
<!-- End Available Resources and Operations [operations] -->
|
|
453
|
+
|
|
454
|
+
<!-- Start Pagination [pagination] -->
|
|
455
|
+
## Pagination
|
|
456
|
+
|
|
457
|
+
Some of the endpoints in this SDK support pagination. To use pagination, you make your SDK calls as usual, but the
|
|
458
|
+
returned response object will have a `Next` method that can be called to pull down the next group of results. If the
|
|
459
|
+
return value of `Next` is `None`, then there are no more pages to be fetched.
|
|
460
|
+
|
|
461
|
+
Here's an example of one such pagination call:
|
|
462
|
+
```python
|
|
463
|
+
from latitudesh_python_sdk import Latitudesh
|
|
464
|
+
import os
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
with Latitudesh(
|
|
468
|
+
bearer=os.getenv("LATITUDESH_BEARER", ""),
|
|
469
|
+
) as latitudesh:
|
|
470
|
+
|
|
471
|
+
res = latitudesh.events.list(page_size=20, page_number=1)
|
|
472
|
+
|
|
473
|
+
while res is not None:
|
|
474
|
+
# Handle items
|
|
475
|
+
|
|
476
|
+
res = res.next()
|
|
477
|
+
|
|
478
|
+
```
|
|
479
|
+
<!-- End Pagination [pagination] -->
|
|
480
|
+
|
|
481
|
+
<!-- Start Retries [retries] -->
|
|
482
|
+
## Retries
|
|
483
|
+
|
|
484
|
+
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.
|
|
485
|
+
|
|
486
|
+
To change the default retry strategy for a single API call, simply provide a `RetryConfig` object to the call:
|
|
487
|
+
```python
|
|
488
|
+
from latitudesh_python_sdk import Latitudesh
|
|
489
|
+
from latitudesh_python_sdk.utils import BackoffStrategy, RetryConfig
|
|
490
|
+
import os
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
with Latitudesh(
|
|
494
|
+
bearer=os.getenv("LATITUDESH_BEARER", ""),
|
|
495
|
+
) as latitudesh:
|
|
496
|
+
|
|
497
|
+
res = latitudesh.api_keys.list(,
|
|
498
|
+
RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
|
|
499
|
+
|
|
500
|
+
# Handle response
|
|
501
|
+
print(res)
|
|
502
|
+
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
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:
|
|
506
|
+
```python
|
|
507
|
+
from latitudesh_python_sdk import Latitudesh
|
|
508
|
+
from latitudesh_python_sdk.utils import BackoffStrategy, RetryConfig
|
|
509
|
+
import os
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
with Latitudesh(
|
|
513
|
+
retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False),
|
|
514
|
+
bearer=os.getenv("LATITUDESH_BEARER", ""),
|
|
515
|
+
) as latitudesh:
|
|
516
|
+
|
|
517
|
+
res = latitudesh.api_keys.list()
|
|
518
|
+
|
|
519
|
+
# Handle response
|
|
520
|
+
print(res)
|
|
521
|
+
|
|
522
|
+
```
|
|
523
|
+
<!-- End Retries [retries] -->
|
|
524
|
+
|
|
525
|
+
<!-- Start Error Handling [errors] -->
|
|
526
|
+
## Error Handling
|
|
527
|
+
|
|
528
|
+
[`LatitudeshError`](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/./src/latitudesh_python_sdk/models/latitudesherror.py) is the base class for all HTTP error responses. It has the following properties:
|
|
529
|
+
|
|
530
|
+
| Property | Type | Description |
|
|
531
|
+
| ------------------ | ---------------- | ------------------------------------------------------ |
|
|
532
|
+
| `err.message` | `str` | Error message |
|
|
533
|
+
| `err.status_code` | `int` | HTTP response status code eg `404` |
|
|
534
|
+
| `err.headers` | `httpx.Headers` | HTTP response headers |
|
|
535
|
+
| `err.body` | `str` | HTTP body. Can be empty string if no body is returned. |
|
|
536
|
+
| `err.raw_response` | `httpx.Response` | Raw HTTP response |
|
|
537
|
+
|
|
538
|
+
### Example
|
|
539
|
+
```python
|
|
540
|
+
from latitudesh_python_sdk import Latitudesh, models
|
|
541
|
+
import os
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
with Latitudesh(
|
|
545
|
+
bearer=os.getenv("LATITUDESH_BEARER", ""),
|
|
546
|
+
) as latitudesh:
|
|
547
|
+
res = None
|
|
548
|
+
try:
|
|
549
|
+
|
|
550
|
+
res = latitudesh.api_keys.list()
|
|
551
|
+
|
|
552
|
+
# Handle response
|
|
553
|
+
print(res)
|
|
554
|
+
|
|
555
|
+
|
|
556
|
+
except models.LatitudeshError as e:
|
|
557
|
+
# The base class for HTTP error responses
|
|
558
|
+
print(e.message)
|
|
559
|
+
print(e.status_code)
|
|
560
|
+
print(e.body)
|
|
561
|
+
print(e.headers)
|
|
562
|
+
print(e.raw_response)
|
|
563
|
+
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
### Error Classes
|
|
567
|
+
**Primary error:**
|
|
568
|
+
* [`LatitudeshError`](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/./src/latitudesh_python_sdk/models/latitudesherror.py): The base class for HTTP error responses.
|
|
569
|
+
|
|
570
|
+
<details><summary>Less common errors (5)</summary>
|
|
571
|
+
|
|
572
|
+
<br />
|
|
573
|
+
|
|
574
|
+
**Network errors:**
|
|
575
|
+
* [`httpx.RequestError`](https://www.python-httpx.org/exceptions/#httpx.RequestError): Base class for request errors.
|
|
576
|
+
* [`httpx.ConnectError`](https://www.python-httpx.org/exceptions/#httpx.ConnectError): HTTP client was unable to make a request to a server.
|
|
577
|
+
* [`httpx.TimeoutException`](https://www.python-httpx.org/exceptions/#httpx.TimeoutException): HTTP request timed out.
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
**Inherit from [`LatitudeshError`](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/./src/latitudesh_python_sdk/models/latitudesherror.py)**:
|
|
581
|
+
* [`ResponseValidationError`](https://github.com/latitudesh/latitudesh-python-sdk/blob/master/./src/latitudesh_python_sdk/models/responsevalidationerror.py): Type mismatch between the response data and the expected Pydantic model. Provides access to the Pydantic validation error via the `cause` attribute.
|
|
582
|
+
|
|
583
|
+
</details>
|
|
584
|
+
<!-- End Error Handling [errors] -->
|
|
585
|
+
|
|
586
|
+
<!-- Start Server Selection [server] -->
|
|
587
|
+
## Server Selection
|
|
588
|
+
|
|
589
|
+
### Select Server by Index
|
|
590
|
+
|
|
591
|
+
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:
|
|
592
|
+
|
|
593
|
+
| # | Server | Variables | Description |
|
|
594
|
+
| --- | ------------------------- | ------------------ | ----------- |
|
|
595
|
+
| 0 | `https://api.latitude.sh` | `latitude_api_key` | |
|
|
596
|
+
| 1 | `http://api.latitude.sh` | `latitude_api_key` | |
|
|
597
|
+
|
|
598
|
+
If the selected server has variables, you may override its default values through the additional parameters made available in the SDK constructor:
|
|
599
|
+
|
|
600
|
+
| Variable | Parameter | Default | Description |
|
|
601
|
+
| ------------------ | ----------------------- | ------------------------------ | ----------- |
|
|
602
|
+
| `latitude_api_key` | `latitude_api_key: str` | `"<insert your api key here>"` | |
|
|
603
|
+
|
|
604
|
+
#### Example
|
|
605
|
+
|
|
606
|
+
```python
|
|
607
|
+
from latitudesh_python_sdk import Latitudesh
|
|
608
|
+
import os
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
with Latitudesh(
|
|
612
|
+
server_idx=0,
|
|
613
|
+
latitude_api_key="<insert your api key here>",
|
|
614
|
+
bearer=os.getenv("LATITUDESH_BEARER", ""),
|
|
615
|
+
) as latitudesh:
|
|
616
|
+
|
|
617
|
+
res = latitudesh.api_keys.list()
|
|
618
|
+
|
|
619
|
+
# Handle response
|
|
620
|
+
print(res)
|
|
621
|
+
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
### Override Server URL Per-Client
|
|
625
|
+
|
|
626
|
+
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:
|
|
627
|
+
```python
|
|
628
|
+
from latitudesh_python_sdk import Latitudesh
|
|
629
|
+
import os
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
with Latitudesh(
|
|
633
|
+
server_url="http://api.latitude.sh",
|
|
634
|
+
bearer=os.getenv("LATITUDESH_BEARER", ""),
|
|
635
|
+
) as latitudesh:
|
|
636
|
+
|
|
637
|
+
res = latitudesh.api_keys.list()
|
|
638
|
+
|
|
639
|
+
# Handle response
|
|
640
|
+
print(res)
|
|
641
|
+
|
|
642
|
+
```
|
|
643
|
+
<!-- End Server Selection [server] -->
|
|
644
|
+
|
|
645
|
+
<!-- Start Custom HTTP Client [http-client] -->
|
|
646
|
+
## Custom HTTP Client
|
|
647
|
+
|
|
648
|
+
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.
|
|
649
|
+
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.
|
|
650
|
+
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.
|
|
651
|
+
|
|
652
|
+
For example, you could specify a header for every request that this sdk makes as follows:
|
|
653
|
+
```python
|
|
654
|
+
from latitudesh_python_sdk import Latitudesh
|
|
655
|
+
import httpx
|
|
656
|
+
|
|
657
|
+
http_client = httpx.Client(headers={"x-custom-header": "someValue"})
|
|
658
|
+
s = Latitudesh(client=http_client)
|
|
659
|
+
```
|
|
660
|
+
|
|
661
|
+
or you could wrap the client with your own custom logic:
|
|
662
|
+
```python
|
|
663
|
+
from latitudesh_python_sdk import Latitudesh
|
|
664
|
+
from latitudesh_python_sdk.httpclient import AsyncHttpClient
|
|
665
|
+
import httpx
|
|
666
|
+
|
|
667
|
+
class CustomClient(AsyncHttpClient):
|
|
668
|
+
client: AsyncHttpClient
|
|
669
|
+
|
|
670
|
+
def __init__(self, client: AsyncHttpClient):
|
|
671
|
+
self.client = client
|
|
672
|
+
|
|
673
|
+
async def send(
|
|
674
|
+
self,
|
|
675
|
+
request: httpx.Request,
|
|
676
|
+
*,
|
|
677
|
+
stream: bool = False,
|
|
678
|
+
auth: Union[
|
|
679
|
+
httpx._types.AuthTypes, httpx._client.UseClientDefault, None
|
|
680
|
+
] = httpx.USE_CLIENT_DEFAULT,
|
|
681
|
+
follow_redirects: Union[
|
|
682
|
+
bool, httpx._client.UseClientDefault
|
|
683
|
+
] = httpx.USE_CLIENT_DEFAULT,
|
|
684
|
+
) -> httpx.Response:
|
|
685
|
+
request.headers["Client-Level-Header"] = "added by client"
|
|
686
|
+
|
|
687
|
+
return await self.client.send(
|
|
688
|
+
request, stream=stream, auth=auth, follow_redirects=follow_redirects
|
|
689
|
+
)
|
|
690
|
+
|
|
691
|
+
def build_request(
|
|
692
|
+
self,
|
|
693
|
+
method: str,
|
|
694
|
+
url: httpx._types.URLTypes,
|
|
695
|
+
*,
|
|
696
|
+
content: Optional[httpx._types.RequestContent] = None,
|
|
697
|
+
data: Optional[httpx._types.RequestData] = None,
|
|
698
|
+
files: Optional[httpx._types.RequestFiles] = None,
|
|
699
|
+
json: Optional[Any] = None,
|
|
700
|
+
params: Optional[httpx._types.QueryParamTypes] = None,
|
|
701
|
+
headers: Optional[httpx._types.HeaderTypes] = None,
|
|
702
|
+
cookies: Optional[httpx._types.CookieTypes] = None,
|
|
703
|
+
timeout: Union[
|
|
704
|
+
httpx._types.TimeoutTypes, httpx._client.UseClientDefault
|
|
705
|
+
] = httpx.USE_CLIENT_DEFAULT,
|
|
706
|
+
extensions: Optional[httpx._types.RequestExtensions] = None,
|
|
707
|
+
) -> httpx.Request:
|
|
708
|
+
return self.client.build_request(
|
|
709
|
+
method,
|
|
710
|
+
url,
|
|
711
|
+
content=content,
|
|
712
|
+
data=data,
|
|
713
|
+
files=files,
|
|
714
|
+
json=json,
|
|
715
|
+
params=params,
|
|
716
|
+
headers=headers,
|
|
717
|
+
cookies=cookies,
|
|
718
|
+
timeout=timeout,
|
|
719
|
+
extensions=extensions,
|
|
720
|
+
)
|
|
721
|
+
|
|
722
|
+
s = Latitudesh(async_client=CustomClient(httpx.AsyncClient()))
|
|
723
|
+
```
|
|
724
|
+
<!-- End Custom HTTP Client [http-client] -->
|
|
725
|
+
|
|
726
|
+
<!-- Start Resource Management [resource-management] -->
|
|
727
|
+
## Resource Management
|
|
728
|
+
|
|
729
|
+
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.
|
|
730
|
+
|
|
731
|
+
[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers
|
|
732
|
+
|
|
733
|
+
```python
|
|
734
|
+
from latitudesh_python_sdk import Latitudesh
|
|
735
|
+
import os
|
|
736
|
+
def main():
|
|
737
|
+
|
|
738
|
+
with Latitudesh(
|
|
739
|
+
bearer=os.getenv("LATITUDESH_BEARER", ""),
|
|
740
|
+
) as latitudesh:
|
|
741
|
+
# Rest of application here...
|
|
742
|
+
|
|
743
|
+
|
|
744
|
+
# Or when using async:
|
|
745
|
+
async def amain():
|
|
746
|
+
|
|
747
|
+
async with Latitudesh(
|
|
748
|
+
bearer=os.getenv("LATITUDESH_BEARER", ""),
|
|
749
|
+
) as latitudesh:
|
|
750
|
+
# Rest of application here...
|
|
751
|
+
```
|
|
752
|
+
<!-- End Resource Management [resource-management] -->
|
|
753
|
+
|
|
754
|
+
<!-- Start Debugging [debug] -->
|
|
755
|
+
## Debugging
|
|
756
|
+
|
|
757
|
+
You can setup your SDK to emit debug logs for SDK requests and responses.
|
|
758
|
+
|
|
759
|
+
You can pass your own logger class directly into your SDK.
|
|
760
|
+
```python
|
|
761
|
+
from latitudesh_python_sdk import Latitudesh
|
|
762
|
+
import logging
|
|
763
|
+
|
|
764
|
+
logging.basicConfig(level=logging.DEBUG)
|
|
765
|
+
s = Latitudesh(debug_logger=logging.getLogger("latitudesh_python_sdk"))
|
|
766
|
+
```
|
|
767
|
+
|
|
768
|
+
You can also enable a default debug logger by setting an environment variable `LATITUDESH_DEBUG` to true.
|
|
769
|
+
<!-- End Debugging [debug] -->
|
|
770
|
+
|
|
771
|
+
<!-- Placeholder for Future Speakeasy SDK Sections -->
|
|
772
|
+
|
|
773
|
+
# Development
|
|
774
|
+
|
|
775
|
+
## Maturity
|
|
776
|
+
|
|
777
|
+
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
|
|
778
|
+
to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
|
|
779
|
+
looking for the latest version.
|
|
780
|
+
|
|
781
|
+
## Contributions
|
|
782
|
+
|
|
783
|
+
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.
|
|
784
|
+
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.
|
|
785
|
+
|
|
786
|
+
### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=latitudesh-python-sdk&utm_campaign=python)
|
|
787
|
+
|