ZKB.py - lockefox/ColdCall GitHub Wiki
zkb.py is included with ColdCall. This Python module is designed to handle most of the funny business of dealing with zKillboard's API. It is meant to work as a simpler go-between for building and executing zKillBoard queries, and handle all data offerings from zKillBoard.
##Why Use zkb.py? zKillboard's API is powerful, but finicky. With the site in forever-beta, the rules may change suddenly, and updating a bunch of sparse zKillboard related code to play nice takes away from other development time. Also, the pipeline can be a little daunting to novice coders. Rather than consistently reinventing the wheel and learning all the little traps and problems, zkb.py is designed to "just work" to scrape down zKillboard data.
This module is still in development, but once completed will allow for quick leverage of:
- zKillboard's API of kill/loss data: Alpha released
- Crawls in DESC chronological order
- Accepts and validates all supported query modifiers
- Can run directly through .fetch() or supports
__iter__
functionality
- zKillboard's stat feeds: TODO
- Removed from offered APIs (might be undocumented)
- zKillboard's STOMP service: TODO
zkb.py has been designed to act as an intermediary to allow developers easier access to zKillboard. Instead of worrying about the ups-and-downs and API changes, just use zkb.py and always get the queries you want, in a standardized query/return format.
Query
A zkb.py Query is meant to mimic the zKillboard API style. It works one of two ways
Object-Style
testQuery = zkb.Query('2013-01-01')
testQuery.api_only #return only api-verified kills
testQuery.characterID(628592330) #fetch Lockefox's data
testQuery.losses #return only losses
In this format, each entry is validated internally and only valid queries are allowed to execute. Commands mirror zKillboard's API modifiers. TODO: leverage more magic methods
An earliest date is required. zkb.py crawls chronologically backwards. TODO: add modifier to crawl forwards.
Manual-Style
testQuery = zkb.Query('2013-01-01',"/api-only/characterID/628592330/losses/")
In this format, a query is loaded as the regular text of a query. This is meant for more debug/one-run kind of queries where you already know the query and don't want to set each element line-by-line. This format is not validated like the Object-Style