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.0.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

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

gw2apiwrapper-2.7.0-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gw2apiwrapper-2.7.0.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for gw2apiwrapper-2.7.0.tar.gz
Algorithm Hash digest
SHA256 427f8a46e004e9266d5bd1892599f23682b180818359e0d3b6fb7b64cf5267c5
MD5 3fbd51f81c905d1d7e082163da2faffa
BLAKE2b-256 8937683057b7992f39c4bab95f62f3682bb03863af46ffb855b20992f7ea63a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gw2apiwrapper-2.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c0c6a1ee1a9cf819e2095bb6a74f1d8507a2c4a5986dc99c7c9a405964f5b9b7
MD5 cf6401451bd13a91dfbf54a3f02b0d9e
BLAKE2b-256 bea5bab047ec12e0da970b524ba06d86a9c728fc91b0671bcd49bfe455f6046f

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