From EVEDev
Jump to: navigation, search
Api.pngAPI Resources - Category Home - API Libraries - API Usage Examples - API Method Reference
Maintainer: Entity
Stable release: 1.1.1
Development release:
OS: Platform independent, Python 2.4+ required
License: MIT
Website: http://github.com/ntt/eveapi



This Python EVE API wrapper is designed to have minimal knowledge of the actual methods and content the API provides, to make it somewhat future-proof. It de-serializes the XML responses into useful python objects which can be easily accessed and manipulated. Usage of the library is very easy and natural.


Copy the eveapi.py into your Python installation's site-packages folder, or just keep it in your project folder.


No documentation available, but the eveapi.py module and the accompanying apitest.py are well commented and explain most if not all functionality. Additionally, the apitest.py is structured like a tutorial.


The following is a simple example that reports how much time you have left on the skill training of your character(s). (It obviously requires the eveapi.py module installed).

For a more thorough and sophisticated example, please look at the apitest.py file on the project website.

import eveapi
watchList = [
	[USERID1, APIKEY1, "Entity"],
	# add data for your characters here
api = eveapi.EVEAPIConnection()
for u, a, name in watchList:
	# let's authenticate the credentials for use
	auth = api.auth(keyID=u, vCode=a)
	# check the characters on this account for the specified character.
	name = name.lower()
	result = auth.account.Characters()
	for c in result.characters:
		if c.name.lower() == name:
			name = c.name
		print "%12s: Error - Not found on account" % name
	# get the current skill in training for this character
        result = auth.char.SkillInTraining()
	if result.skillInTraining:
		# following assumes the result object's timestamp equals TQ's actual time.
		timeLeft = result.trainingEndTime - result._meta.currentTime
		if timeLeft < 0:
			complete = True
			timeLeft = -timeLeft
			complete = False
		# make a nice formatted time string
		s = timeLeft % 60
		m = (timeLeft/60) % 60
		h = (timeLeft/3600) % 24
		d = (timeLeft/86400)
		timeString = "%2dd %2dh %2dm %2ds" % (d, h, m, s)
		if complete:
			print "%12s: TRAINING COMPLETE (%s ago)" % (name, timeString)
			print "%12s: %s" % (name, timeString)			
		print "%12s: NOT TRAINING" % name


Retrieved from "?title=Eveapi&oldid=6512"
Personal tools