Package: cursepy
cursepyA modular API for interacting withCurseForge.This project is in work progress but because of the complicated Curse API deprecation, this might be finished longer than expected!The documentation for cursepy is still a work in progress!
The core content will remain the same,
but expect minor corrections and rephrasing.Introductioncursepy allows you to interact with CurseForge,
which allows you to add, addons and files in a simple, easy to use format.
We offer easy entry points into certain CurseForge APIs and backends.Our goal is to be modular and heavily customizable for developers who
have very specific wants and needs, while also being simple and intuitive
for developers who want something that 'just works'.We support getting information on all games,
addons, categories, files, and so much more!
We also offer easy to use methods for downloading files.ExamplefromcursepyimportCurseClient# Import the CurseClientGAME_ID=432# ID of the game you want to fetch, in this case Minecraft# Create the CurseClient:curse=CurseClient(API_KEY)# Get the game info:game=curse.game(GAME_ID)# Print the name of the game:print(game.name)FeaturesHere, we will give brief descriptions of cursepy features:Ease of Useusing cursepy is very simple!
Simply import the CurseClient class:fromcursepyimportCurseClient# Create the client:client=CurseClient(API_KEY)# Get a tuple of all games:games=client.games()The CurseClient offers simple to use navigational methods for obtaining necessary information from CurseForge.
Because CurseClient utilizes the official CurseForge API, we require anAPI keyto use.
CurseClient also allows for callbacks to be bound to events,
meaning when an event is fired,
your custom callback will also be cued.
Here is an example of this in action:# Define a custom callback:defcallback(data)# Print the data we have:print(data)# Bind the callback to the ADDON event:client.bind_callback(callback,client.ADDON)When the ADDON event is triggered, then this callback will be called,
and the data we received by the handler will be passed along to the callback.If you want a closer look at working with CurseClient,
you should check out theCurseClient Documentation.Modular DesignEach operation is managed by a component called a 'handler'.
Handlers are simply classes that get information and process it.
This information can be from any location
and it can be retrieved in many different ways.
Here is an example of a simple handler thats pulls HTTP data from somewhere and returns it:fromurllib.requestimporturlopen# Import the BaseHandler:fromcursepy.handlers.baseimportBaseHandlerclassHTTPGet(BaseHandler):defhandle(self):# Get and return HTTP data:returnurlopen('somedomain.com/some/path')The only limit is your imagination!Our modular method allows for functionality to be swapped and
mixed around, allowing for automated and easier customization
compared to sub-classing.cursepy has extensive documentation on handler development,
which contains best practice recommendations. Docs on the cursepy Handler Framework(CHF)/tutorials on how to use the development handlers are already built into cursepy.
Have a look at theHandler Development Tutorial!Curse InstancesAs stated earlier, curse data can come from any location,
which can be retired in many different ways.
Because of this, the developer would have to check and work
with data in many different formats and in many different makeups.Not ideal!cursepy offers curse instances that normalize data,
and offer a container for data to be kept in.
This ensures that no matter what
the developer will be working with data in the same way,
regardless of how or where we got the data from.
They're dataclasses, which makes retrieving and working
with information very easy.Curse Instances have plenty of other nifty features for
easing your development, so be sure to check out theCurseInstance Tutorial!WrappersWrappers ease the process of interacting with certain games and projects on CurseForge.
They do this by keeping track of relevant information, such as game and category ID's,
so you, as the developer, do not have to.For example, the 'MinecraftWrapper' eases the process of getting
information on Minecraft projects and addons.
We hope to implement more wrappers for more games at a later date.Have a look at theWrapper Tutorialfor more info!InstallationYou can install cursepy via pip:pipinstallcursepyFor more information on installing cursepy,
check out the installation section in ourdocumentation.DocumentationAs stated many times before, we have an extensive documentation. It contains tutorials, the API reference,
and best practice recommendations.If you don't know this already, the documentation can be found here:https://cursepy.readthedocs.io/en/latest/index.htmlBe sure to check out thecursepy PyPi pagefor more informationThe documentation is built usingsphinx.
Building the docs yourself is very simple.
You can start by installing sphinx:pipinstallsphinxNow, navigate to the 'docs' directory in your favorite terminal.
Next, you can issue the 'make' command to build the docs:makehtmlThis will build the docs into HTML,
and will be placed into build directory.ContributingPull requests are welcome and encouraged! If you want to see a feature in cursepy
or have a fix for a bug you came across, then a PR will be the fastest way for you
to get the change (included in cursepy).If you wish to simply report a bug, then you should open an issue,
and I will get back to you as soon as I can.I also accept comments and feedback at my email address listed under my GitHub account.ChangelogYou can have a look at the changeloghere.Special ThanksSir Quinn - Documentation workSally Miller - Proof readingConclusioncursepy offers a pythonic, intuitive way to interact with CurseForge projects!
We offer high levels of customizability
while at the same time being easy to use.