Giter Site home page Giter Site logo

gw2apiwrapper's Introduction

gw2apiwrapper Build Status Coverage Status

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.

gw2apiwrapper's People

Contributors

dapinkone avatar dependabot[bot] avatar patchesprime avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

dapinkone

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.