Skip to main content

A simple Python wrapper for the WarFrame API

Project description

PyLotus

PyLotus is a simple Python wrapper for the Warframe API.

Description

This is a super simple wrapper for the Warframe API, information about which can be found here. Most requests to the API have been implemented; any that haven't been can be retrieved by requesting the worldstate. Also provided are some basic prebuilt classes to hold common responses like individual Fissure objects, etc.

Dependencies

PyLotus only uses the built-in requests and json libraries, with pytest only being used to implement testing. These are all installable and upgradeable via pip.

Installation

Use the package manager pip to install PyLotus.

pip install pylotus

Usage

All platforms are supported for use with the API wrapper; a list containing the platform shorthand notations accepted by the API are accessible through the static wf_api.get_platforms().

from pylotus import *

print(wf_api.get_platforms()) # It's always possible to retrieve all supported platforms with which to construct the API, even in a static context.
>>> ['pc', 'ps4', 'xb1', 'swi']

Create a wf_api instance that can access the WarFrame API for a specified platform. Retrieve information from the API with the responses stored in lists of easily accessed JSON-formatted dict objects or individual objects.

xbox_api_wrapper = wf_api('xb1') # Create an instance with your preferred platform.

current_fissures = xbox_api_wrapper.get_current_fissures() # Get back a list of JSON response dicts or a single JSON response dict.

do_something_with_the(current_fissures)

Use built-in classes, like the Fissure class, to easily wrap common API responses. Pass the class constructors the retrieved JSON representations of the API returns.

fissure_objects = [Fissure(fissure) for fissure in current_fissures]

print(len(fissure_objects))
for f in fissure_objects:
	print(type(f), f.enemy, f.missionType)
>>> 4
>>> Fissure, Grineer, Defense
>>> Fissure, Corpus, Defense
>>> Fissure, Grineer, Interception
>>> Fissure, Grineer, Mobile Defense

You can also import only the API interface, skipping the prebuilt classes if you would rather. Do this by importing as follows:

from pylotus import wf_api

Exceptions and Error Handling

There are 3 custom exceptions (termed Errors) in PyLotus: NonPlatformError, raised when the platform passed to the wf_api constructor is invalid; DictTypeError, raised when incorrect objects (not dicts or not correct dicts) are passed to class constructors; and StatusCodeError, raised when the WarFrame API itself returns a non-200 response. These all have error messages associated with them accessible through Error.message.

License

Licensed under the MIT license.

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

pylotus-1.0.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pylotus-1.0.0-py2.py3-none-any.whl (7.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pylotus-1.0.0.tar.gz.

File metadata

  • Download URL: pylotus-1.0.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for pylotus-1.0.0.tar.gz
Algorithm Hash digest
SHA256 579bb633581298fa967390f11985d3f97b425905fd11d1fac1816f23d711c5e3
MD5 de56160dace9e854ea11100de9c5b6c8
BLAKE2b-256 97925b52114ae63f72c7a22393ab9fff7e849bcb46cf26eb75df8e2b2f5b6f5c

See more details on using hashes here.

File details

Details for the file pylotus-1.0.0-py2.py3-none-any.whl.

File metadata

  • Download URL: pylotus-1.0.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for pylotus-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4fa79549d2aafb5f745d9317f03c0d9df89ed81e34509cdba1d3e8727db092fb
MD5 48d1a2e5e5c75400a0e79823a1782f7e
BLAKE2b-256 b2d22419f02ebe5c751e0ed5fc9265f032c80885745441bebb764f3611c04b1f

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