Skip to main content

A simple wrapper around the offical Guild Wars 2 JSON API.

Project description

gw2apiwrapper is a Python library designed to abstract away the overhead and complexity of interacting with the official Guild Wars 2 (GW2) API via Python.

The library aims to make it easy to write and read Python applications and tools with only a minimal knowledge of the GW2 API itself.

This is accomplished by abstracting away the standard JSON->dictionary mapping scheme that is so commonly used and replace it with an OOP-style (eg. item.name) notation.

Installation

Simply install with pip/pipenv and you’re good to go:

pip install gw2apiwrapper

Example

from gw2apiwrapper import AccountAPI, GlobalAPI

# Get an account based object. Requires API Key.
personal = AccountAPI("<APIKEY>")

# Get a 'Global' api object. (Non-authed)
workHorse = GlobalAPI()

# This is iterable, as not only does it fill the personal.bank
# attribute, it also returns that information allowing it to be
# used in loops..even though we don't here.
personal.getBank()

# Should be self documenting, but demonstrates that the previous
# getBank() call actually populated that object's 'bank' attribute.
bankIDs = [slot['id'] for slot in personal.bank if slot is not None]

# GlobalAPI's getItem can take different types, all documented.
itemObjects = workHorse.getItem(bankIDs)

# Get the names of all items in bank.
for item in itemObjects:
  print(item.name)

NOTES

This project is in semi-active development. The groundwork is laid, and most of the API is accounted for. If something you need is missing and you’d like it added feel free to open an issue (or a pull request!) on GitHub.

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

gw2apiwrapper-2.7.5.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

gw2apiwrapper-2.7.5-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file gw2apiwrapper-2.7.5.tar.gz.

File metadata

  • Download URL: gw2apiwrapper-2.7.5.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.3

File hashes

Hashes for gw2apiwrapper-2.7.5.tar.gz
Algorithm Hash digest
SHA256 38e2125dedcf4060bba1a1282fa16e1154ae3035982047d69ff3f9b23966316d
MD5 2eccd3432322a84f92b118d59e7e98d2
BLAKE2b-256 c13dbaa0413b45d2576ee790c5f657d659fbfe3620282a1fd3a3a699b948d96b

See more details on using hashes here.

File details

Details for the file gw2apiwrapper-2.7.5-py3-none-any.whl.

File metadata

  • Download URL: gw2apiwrapper-2.7.5-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.3

File hashes

Hashes for gw2apiwrapper-2.7.5-py3-none-any.whl
Algorithm Hash digest
SHA256 23c836200c99964d40372bd5bfdf6930977d28b114faba13f48b0ad4f014fd23
MD5 62bba50fbd86c735895855d611b44b5e
BLAKE2b-256 d97a50521072377b555a9b13415900c49f4e843a1565c9374f603659916db723

See more details on using hashes here.

Supported by

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