Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
from evesrp.killmail import ZKillmail
import gdata.spreadsheets.client
from decimal import Decimal
# patch the spreadsheet's client to use the public feeds
gdata.spreadsheets.client.PRIVATE_WORKSHEETS_URL = \
gdata.spreadsheets.client.WORKSHEETS_URL = (''
gdata.spreadsheets.client.PRIVATE_LISTS_URL = \
gdata.spreadsheets.client.LISTS_URL = (''
class AutomagicPayout(ZKillmail):
# The spreadsheet's key
# (
# Make sure the spreadsheet has been published (File->Publish to web...)
spreadsheet_key = 'THE_PART_HERE'
# The name of the worksheet with the payouts
worksheet_name = 'Payouts'
# The header for the hull column (always lowercase, the Google API
# lowercases it).
hull_key = 'hull'
# And the same for the payout column
payout_key = 'payout'
client = gdata.spreadsheets.client.SpreadsheetsClient()
def value(self):
# Find the worksheet
sheets = self.client.get_worksheets(self.spreadsheet_key)
for sheet in sheets.entry:
if sheet.title.text == self.worksheet_name:
worksheet_id = sheet.get_worksheet_id()
return Decimal('0')
# Read the worksheet's data
lists = self.client.get_list_feed(self.spreadsheet_key, worksheet_id,
self.hull_key, self.ship)))
for entry in lists.entry:
return Decimal(entry.get_value(self.payout_key))
return Decimal('0')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment