Skip to main content

Django Integration of the Riot Games Developer API Wrapper 'cassiopeia'

Project description

MIT Licensed

Django Cassiopeia

Django Cassiopeia has finished beta test, Django Cassiopeia 2 has backward incompatible changes, please check them out here.

An Integration of Cassiopeia to the Django Framework (Compatible with DRF) with enhanced new features.

Cassiopeia is a Python adaptation of the Riot Games League of Legends API (https://developer.riotgames.com/). For instance it is also the sister library to Orianna (Java). It's been designed with usability in mind - making sure all the bookkeeping is done right so you can focus on getting the data you need and building your application.

Documentation

Django Cassiopeia has detailed documentation. For functions and methods of Cassiopeia is found in this documentation.

Installation and Requirements

Django>=3.0.1
Python>=3.6

pip install django-cassiopeia

v2.1

Starting version 2.1, django-cassiopeia will no longer contain cassiopeia in its modules, instead it will wrap you original cassiopeia framework with the necessary changes in place. This makes easy to get ahead of fixes of the main library without the need of me doing pararel updates, when cassiopeia updates a new version, you can get going by only upgrading cassiopeia with pip install cassiopeia --upgrade.

Quick Start

In your settings.py:

INSTALLED_APPS = [
    # ...
    'django_cassiopeia',
]

CASSIOPEIA_RIOT_API_KEY = os.environ["RIOT_API_KEY"]  # api key in env var
CASSIOPEIA_DEFAULT_REGION = "NA"   # default region
CASSIOPEIA_PIPELINE = {   # small pipeine to get started
    "Omnistone": {},
    "DDragon": {},
    "RiotAPI": {},
}

In your views.py that you wish to use cassiopeia functions:

from django_cassiopeia import cassiopeia as cass
from django.http import JsonResponse
from django.views import View

class SummonerView(View): # Django CBV with json response
    def get(self, request):
        summoner = cass.Summoner(name="Kalturi")
        return JsonResponse({"name": summoner.name, "level": summoner.level})

Reminder: it can be used anywhere as long as you do the correct import:

from django_cassiopeia import cassiopeia 
# You can add "as cass" for shorter module name ^.

Integrated Features

  • Bypass the limitation of cassiopeia caching: No more worries about memory issues! Now you have the ability to use Django's cache framework for your caching, compatible with any cache backends that Django supports (Filebased, Database, Redis, MemCached, LocalMem, more).

  • Same performance (New in 2.0): You still get the same fast performance as cassiopeia's Cache, here you have its fine tuned version called Omnistone and safe to use (I am looking at you memory hunter).

  • Prevent infinite instances: Weird things will happen if you don't import correctly cassiopeia in your Django project (happens to Flask too), now you add to INSTALLED_APPS and import it from there, no more infinite intances crashing around.

  • Adapted settings syntax: Keep all settings in one place, the standard place -> settings.py, with adapted syntax that fits into the Django trend.

High Concurrency and AsyncIO

Currently Cassiopeia is 98% thread safe with some exception on the patch number files that complains about a generator in extreme cases. So you can feel 98% safe to multithread Cassiopeia in your environments.

If you need higher concurrency and wants to work with AsyncIO then consider using my AsyncIO based framework Pyot. It works like magic, benchmarks of 60 to 90 calls per second on a CPU optimized machine at extreme cases. It has extremely similar syntax to Cassiopeia, supports Django out of the box, wide range of Caches (Django, Redis, Disk, MongoDB), access to CDragon and MerakiCDN.

Questions/Contributions/Bugs

  • For Django Cassiopeia: Feel free to send pull requests or to contact us via this github or our general discord. More information can be found in our documentation.
  • For Cassiopeia: feel free to send pull requests or to contact cassiopeia devs via cassiopeia's github or the same discord server. More information about main cassiopeia is found in this documentation.

Disclaimer

Django Cassiopeia existence is acknowleged by cassiopeia's former developers. Both package/framework/library is updated in parallel with some exceptions due to the fact of different use cases.

Cassiopeia/Django-Cassiopeia isn't endorsed by Riot Games and doesn't reflect the views or opinions of Riot Games or anyone officially involved in producing or managing League of Legends. League of Legends and Riot Games are trademarks or registered trademarks of Riot Games, Inc. League of Legends © Riot Games, Inc.

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

django-cassiopeia-2.1.1.tar.gz (20.1 kB view details)

Uploaded Source

Built Distribution

django_cassiopeia-2.1.1-py3-none-any.whl (23.6 kB view details)

Uploaded Python 3

File details

Details for the file django-cassiopeia-2.1.1.tar.gz.

File metadata

  • Download URL: django-cassiopeia-2.1.1.tar.gz
  • Upload date:
  • Size: 20.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.15

File hashes

Hashes for django-cassiopeia-2.1.1.tar.gz
Algorithm Hash digest
SHA256 a496977110a14fe581241c73133907db1e420405a31e918660f8a2caf53cac2f
MD5 0db6f1289bcd5a0f698b81fae73d0163
BLAKE2b-256 f5fe142bcd58167667447d723b8c185861c1a9bf2392bbea2cb9b7460149ef7d

See more details on using hashes here.

File details

Details for the file django_cassiopeia-2.1.1-py3-none-any.whl.

File metadata

  • Download URL: django_cassiopeia-2.1.1-py3-none-any.whl
  • Upload date:
  • Size: 23.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.15

File hashes

Hashes for django_cassiopeia-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 27022e5869d361f2b7f33e153e775eca8fcffe1437ae64f5006506051d21a5f4
MD5 1aa94122059df6e048adcf8305d38d98
BLAKE2b-256 da54ade9de19935b50607e693e555a34e9145dec4db19ea96227ce4953feaf25

See more details on using hashes here.

Supported by

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