Skip to content

Instantly share code, notes, and snippets.

@shaetads
Last active December 17, 2021 05:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shaetads/a774f39e015ac20db5d961a8994fd3d7 to your computer and use it in GitHub Desktop.
Save shaetads/a774f39e015ac20db5d961a8994fd3d7 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 20 21:19:56 2016
@author: ShaeTads
@licence: MIT
"""
import urllib
from bs4 import BeautifulSoup
#Eve Online xml API
base_url = 'https://api.eveonline.com'
corps_path = '/corp/CorporationSheet.xml.aspx'
argument = 'corporationID='
starter_corps = [
#Gallente
{'name': 'Center for Advanced Studies', 'id': 1000169},
{'name': 'Federal Navy Academy', 'id': 1000168},
{'name': 'University of Caille', 'id': 1000115},
#Caldari
{'name': 'School of Applied Knowledge', 'id': 1000044},
{'name': 'Science and Trade Institute', 'id': 1000045},
{'name': 'State Was Academy', 'id': 1000167},
#Amarr
{'name': 'Hedion University', 'id': 1000165},
{'name': 'Imperial Academy', 'id': 1000166},
{'name': 'Royal Amarr Institute', 'id': 1000077},
#Minmatar
{'name': 'Pator Tech School', 'id': 1000172},
{'name': 'Republic Military School', 'id': 1000170},
{'name': 'Republic University', 'id': 1000171}
]
#Change this to member_count = [] if uncommenting the http request loop below
member_count = [1048548, 1384848, 680336, 752271, 660199, 1629420, 378692,
752366, 482459, 414969, 848182, 413265]
#for corp in starter_corps:
# url = base_url + corps_path + '?' + argument + str(corp['id'])
# print(url)
# response = urllib.request.urlopen(url).read()
# soup = BeautifulSoup(response, 'lxml')
# count = soup.find('membercount')
# member_count.append(int(count.text))
print('\nCharacters per starter corporation:\n')
print('{:30s}{:>20s}'.format('Corporation Name', 'Member Count'))
print('-'*50)
for i, count in enumerate(member_count):
print('{:30s}{:20,d}'.format(starter_corps[i]['name'], count))
print('-'*50)
print('{:>30s}{:20,d}'.format('Total', sum(member_count)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment