A Python SDK for the Gamewire API
Project description
Gamewire Python SDK
A Python SDK for interacting with the Gamewire API.
Installation
You can install the Gamewire SDK using pip:
pip install gamewire
Usage
Here's a quick example of how to use the Gamewire SDK:
from gamewire import GamewireClient
# Initialize the client
client = GamewireClient("your_email@example.com", "your_password")
# Get user balance
balance = client.get_balance()
print(f"Your balance is: {balance['balance']}")
# Create an instance
instance = client.create_instance("eu-1", "RTX 3070", "Linux", 100)
print("Instance created:", instance)
# Get instance details
instance_details = client.get_instance()
print("Instance details:", instance_details)
Available Methods
The GamewireClient provides the following methods:
get_balance(): Retrieve the user's balanceget_instance(): Get details of the current instancestart_instance(): Start an instancestop_instance(): Stop an instanceget_regions(): Get available regionsget_region(region): Get details of a specific regioncreate_instance(region, instance_type, os, storage): Create a new instancedelete_instance(): Delete the current instance
Authentication
The SDK handles authentication automatically. Simply provide your email and password when initializing the GamewireClient:
client = GamewireClient("your_email@example.com", "your_password")
The client will manage the authentication token for you.
Error Handling
The SDK uses requests' built-in exception handling. If an API request fails, it will raise an HTTPError exception. You can catch and handle these exceptions in your code:
from requests.exceptions import HTTPError
try:
balance = client.get_balance()
except HTTPError as e:
print(f"An error occurred: {e}")
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gamewire-1.0.0.tar.gz.
File metadata
- Download URL: gamewire-1.0.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc6a41485a1fc14031203153098fa86d7cd2060140170a8ff90229b6c92c6ce1
|
|
| MD5 |
008d6e797d42910b987dcee520fb5b5b
|
|
| BLAKE2b-256 |
062c4c3cc8a57f91480eb07d8c86f2e72284153c30ceef990c3a5527a0eea248
|
File details
Details for the file gamewire-1.0.0-py3-none-any.whl.
File metadata
- Download URL: gamewire-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91d13c2b0c69d3367485eecfd017494ba93e57a56d553f09ebbd9462eb1b291f
|
|
| MD5 |
4e4a4cff63aa512feed5a9c6a3a1a756
|
|
| BLAKE2b-256 |
afc7480d7430f26313f6c2ed14505c93a7e5220450fd422adcf3106d669ee418
|