Skip to main content

A Python wrapper for the Discord API

Project description

A modern, easy to use, Pythonic API wrapper for the Will of Steel API in Python.

Installing

Python 3.8 or higher is required

On windows, the library can be installed using the following command:

py -3 -m install willofsteel

On macOS/linux, use the following command:

python3 pip install willofsteel

If desired, you can also clone the repository directly:

git clone https://github.com/WillofSteel-Devs/api-wrapper

Using the library

Creating a Client

To create a client to interact with the API with, you can use the followning code:

import willofsteel

API_KEY = 'Place your api key here'

client = willofsteel.Wrapper(API_KEY)

Example

A quick example of using this library is to look up your profile every hour and send the results to a text file, this can be accomplished with the following:

import willofsteel
import time

API_KEY = 'Place your api key here'
client = willofsteel.Wrapper(API_KEY)


def scheduled_query():

    # Querying the api for the api key holder's profile
    player = client.get_player()

    # Creating a file name to log the results with
    timestamp = time.asctime().replace(':', '_')

    # Logging results
    with open(f'{timestamp}.txt', 'x', encoding='utf-8') as f:
        f.write(player)

    print(f"Query made at {timestamp}")

while True:
    scheduled_query()
    time.sleep(3600)

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

willofsteel-0.1.tar.gz (8.3 kB view details)

Uploaded Source

File details

Details for the file willofsteel-0.1.tar.gz.

File metadata

  • Download URL: willofsteel-0.1.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.5

File hashes

Hashes for willofsteel-0.1.tar.gz
Algorithm Hash digest
SHA256 e429712e181668e94c8b707c5b4439260f4320dcfe705002ee13f537f89dfb36
MD5 3ac99c066eb23e86a3a323695611c44b
BLAKE2b-256 8508cc975c8a8f9275d50801d81b7b5533919c04d49c62f78f8ad8eb49c49c40

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