Skip to main content

wrapper and utils for League of Legends API

Project description

It is python wrapper for League of Legends api that watch out to not exceed rate limit.

Tested on python 3.5

Full api documentation: link


Package is available on PyPI so just use:

pip install lol_api

or to install from source:

git clone

python test

python install


First you need to set up few thing. To do so import settings.

from lol_api.settings import settings
settings.API_KEY = 'your_api_key'
# If you do not wont to pass region to each api call just do:
settings.REGION_DEFAULT = 'some_region'
# Now if you are going to use watcher daemon you have to pass server info:
settings.DAEMON_SERVER = ('server_ip', port)
# If you prefer to use local watcher instance


from lol_api.settings import settings
from lol_api.api.champion import champion

settings.API_KEY = 'mysecretapikey123'
settings.REGION_DEFAULT = 'eune'

data = champion(champion_id=2)


To use Daemon for watching request count run him in another python instance.

from lol_api.daemon import ApiDaemon
daemon = ApiDaemon()

Additional arguments:

  • port - Port to run on. Default(8877)
  • host - Host for socketserver.ThreadingTCPServer. Default(‘localhost’)
  • production - set requests limit for production limits. Default(False)
  • unlimited - do not count requests. Default(False)
  • log - printout information about inquiry. Default(True)

Extra arguments:

To specify the region pass region='your_region' as the argument to method, if not specified region_default passed to Client will be used.

If lol api accept optional arguments, it should be pass as a keyword named exactly as expected by api. eg.


Additional Data:

  • error_codes - Explain error codes that you can get from requests
  • regions - map region names to shortcuts
  • platforms - map region shortcuts to platform name
  • queue_types - map queue names to short descriptions
  • api_versions - map APIs to versions

Rate limit:

Wrapper automatically watch to not exceed requests rate limit per region. Default value is 10 per 10 seconds and 500 per 10 minutes. This is default limit for non production keys. Id order to use production limit ( 3000 per 10 seconds and 180000 per 10 minutes ) set PRODUCTION to True in settings.

lol_api.settings.settings.PRODUCTION = True

You can also turn this off by setting UNLIMITED=True.

If Rate limit is exceeded ``lol_api.exceptions.RateLimitExceededError`` will be raised.

Running tests

Requirements for tests are in tests_requirements.txt file.

To run tests:

pip install -r tests_requirements.txt


or run:

python test


  • Better documentation
  • Add possibility to cache responses
  • Add inplace translation champion name to id
  • Queue for requests when limit exceeded

Project details

Download files

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

Files for lol-api, version 0.2.2
Filename, size File type Python version Upload date Hashes
Filename, size lol_api-0.2.2.tar.gz (9.3 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page