GithubHelp home page GithubHelp logo

mrbartusek / corkus.py Goto Github PK

View Code? Open in Web Editor NEW
8.0 4.0 1.0 22.03 MB

Asynchronous, feature-rich and easy to use Python wrapper for Public Wynncraft API ⚙️

Home Page: https://corkuspy.readthedocs.io

License: MIT License

Python 100.00%
wynncraft wynncraftapi api wrapper python

corkus.py's Introduction

corkus banner

pypi GitHub Workflow Status docs build Codecov python version downloads

Corkus.py ⚙️

Caution

Corkus.py is no longer maintained

Due to recent changes in the Wynncraft API, Corkus.py is no longer working and will not receive further updates or support. Some endpoints based on the v2 API may still be operational, but those relying on the now-removed v1 API and new v3 API are no longer functioning. Additionally, more features may become broken in the future.

I'm unable to recommend any other Python-based wrapper for the Wynncraft API - I don't see any good alternatives. It is strongly advised to not use this project anymore due to its outdated and non-functional state.

Thank you to all users and contributors for your support and feedback throughout the lifespan of this project.

Asynchronous, feature-rich and easy to use Python wrapper for Public Wynncraft API.

Key Features

  • Modern asynchronous API using async/await syntax.
  • Easy to use with an object oriented design using fetch and helper functions.
  • 100% coverage of the Wynncraft API.
  • Proper rate limit handling that prevents 429s.
  • Responses caching to improve speed.

Installation

Python 3.8+ or higher is required

pip install corkus.py

Or install latest development version:

pip install --upgrade git+https://github.com/MrBartusek/corkus.py@main

See documentation for more information.

Quick Example

Using Context Manager:

import asyncio
from corkus import Corkus

async def player_stats():
    async with Corkus() as corkus:
        player = await corkus.player.get("MrBartusekXD")
        character = player.best_character
        print(f"username: {player.username}")
        print(f"best character: {character.display_name} ({character.combat.level}lv)")

loop = asyncio.get_event_loop()
loop.run_until_complete(player_stats())

Without Context Manager:

import asyncio
from corkus import Corkus

async def player_stats():
    corkus = Corkus()
    await corkus.start()

    player = await corkus.player.get("MrBartusekXD")
    character = player.best_character
    print(f"username: {player.username}")
    print(f"best character: {character.display_name} ({character.combat.level}lv)")

    await corkus.close()

loop = asyncio.get_event_loop()
loop.run_until_complete(player_stats())

Output:

username: MrBartusek
best character: Mage (102lv)

Contributing

Want to contribute to the project?

First of all, thanks! Check contributing guidelines for more information.

Links

corkus.py's People

Contributors

misode avatar mrbartusek avatar pianoplayer1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

corkus.py's Issues

Better handling of IDs

Wynntils Athena has a neat system for providing value type of identification likes so:

"rawHealthRegen": {
  "type": "INTEGER",
  "isFixed": false,
  "baseValue": -180
},

Corkus should use a similar system, it makes coding items cards so much simpler when the type of the value is known.

Possibly add text transforming to enums

Currently converting enum values to user-friendly names is kinda tricky. For example, displaying the player's role in guild looks like:

player.member.rank.value.title()

This could be converted to something like

player.member.rank.display_name()

It requires further elaboration and checking other possible solutions.

Split client initalization into `.initialize()`

Handling client initialization can be tricky using the current constructor method. the constructor should be able to be called everywhere and all asynchronous initialization should be kept in the async function.

Update teritory endpoint

From dev discord:

Its me again at everyone! The legacy territory endpoint has been patched and should be answering as expected now.
We weren't going to touch how it was due to it being a legacy API but we removed the attacker field that was deprecated since 1.20 and included the prefix of the guild that owns the territory as the guildPrefix field.

Here is an example of a territory object:

"Ragni": {
  "territory": "Ragni",
  "guild": "KongoBoys",
  "guildPrefix": "DUDE",
  "acquired": "2023-02-06 08:26:20",
  "location": {
    "startX": -955,
    "startY": -1415,
    "endX": -756,
    "endY": -1748
  }
}

Hopefully you can make use of the new field, and as always thanks for your patience

Add discord.py tutorial

Since it's one of primary library usages there should be a explicit guide how to use corkus with discord

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.