Skip to main content

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 balance
  • get_instance(): Get details of the current instance
  • start_instance(): Start an instance
  • stop_instance(): Stop an instance
  • get_regions(): Get available regions
  • get_region(region): Get details of a specific region
  • create_instance(region, instance_type, os, storage): Create a new instance
  • delete_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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gamewire-1.0.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gamewire-1.0.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

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

Hashes for gamewire-1.0.0.tar.gz
Algorithm Hash digest
SHA256 bc6a41485a1fc14031203153098fa86d7cd2060140170a8ff90229b6c92c6ce1
MD5 008d6e797d42910b987dcee520fb5b5b
BLAKE2b-256 062c4c3cc8a57f91480eb07d8c86f2e72284153c30ceef990c3a5527a0eea248

See more details on using hashes here.

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

Hashes for gamewire-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 91d13c2b0c69d3367485eecfd017494ba93e57a56d553f09ebbd9462eb1b291f
MD5 4e4a4cff63aa512feed5a9c6a3a1a756
BLAKE2b-256 afc7480d7430f26313f6c2ed14505c93a7e5220450fd422adcf3106d669ee418

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page