Eveapi

Library.png
eveapi - Visit eveapi - Other Libraries


Contents

Project Details

Project.png
Name eveapi
Website.png
Websitehttp://home.wanadoo.nl/ntt/eve/library/
User.png
MaintainerEntity
License.png
LicenseMIT
OS.png
OSPlatform independent, Python 2.4+ required
Page white code red.png
Language{{{language}}}


Description

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.

Installation

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

Documentation

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.

Example

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"],
	[USERID2, APIKEY2, "NAME2"],
	# add data for your characters here
]

api = eveapi.EVEAPIConnection()

for u, a, name in watchList:

	# check the characters on this account for the specified character.
	name = name.lower()
	result = api.account.Characters(userID=u, apiKey=a)
	for c in result.characters:
		if c.name.lower() == name:
			name = c.name
			break
	else:
		print "%12s: Error - Not found on account" % name
		continue

	# get the current skill in training for this character
	result = api.char.SkillInTraining(userID=u, apiKey=a, characterID=c.characterID)
	
	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
		else:
			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)
		else:
			print "%12s: %s" % (name, timeString)			
	else:
		print "%12s: NOT TRAINING" % name

Links