Ejemplo n.º 1
0
    def main(self):
        """Program Main flow"""
        global LOGGER
        if not self.debug:
            self._log_builder.configure_discord_logger()
        LOGGER = self._log_builder.logger

        LOGGER.info('Getting Map info')

        eveapi.set_user_agent("eveapi.py/1.3")

        api = eveapi.EVEAPIConnection()

        kills = api.map.kills()
        jumps = api.map.Jumps()
        facWarSystems = api.map.FacWarSystems()
        sovereignty = api.map.Sovereignty()

        killsDataframe = convert_to_panda(kills, KILLS_FIELDS.split(','))
        jumpsDataframe = convert_to_panda(jumps, JUMPS_FIELDS.split(','))
        facWarSystemsDataframe = convert_to_panda(facWarSystems,
                                                  FAC_FIELDS.split(','))
        sovereigntyDataframe = convert_to_panda(sovereignty,
                                                SOV_FIELDS.split(','))

        LOGGER.info('Saving to CSV File')
        killsDataframe.to_csv("kills.csv")
        jumpsDataframe.to_csv("jumps.csv")
        facWarSystemsDataframe.to_csv("facWarSystems.csv")
        sovereigntyDataframe.to_csv("sovereignty.csv")
Ejemplo n.º 2
0
async def main():
    # Put your userID and apiKey (full access) here before running this script.
    YOUR_KEYID = 111111111
    YOUR_VCODE = "KiF5SwEEwaaazYpzGtBfGSYc6GBl7cil9y3nofkjCO3yOMVp9gM4Hp6bZeEtmyu7"

    # Provide a good User-Agent header
    eveapi.set_user_agent("eveapi.py/1.3")
    api = eveapi.EVEAPIConnection()

    auth = api.auth(keyID=YOUR_KEYID, vCode=YOUR_VCODE)

    result2 = await auth.account.Characters()

    # Some tracking for later examples.
    rich = 0
    rich_charID = 0

    # Now the best way to iterate over the characters on your account and show
    # the isk balance is probably this way:
    for character in result2.characters:
        wallet = await auth.char.AccountBalance(characterID=character.characterID)
        isk = wallet.accounts[0].balance
        print(character.name, "has", isk, "ISK.")

        if isk > rich:
            rich = isk
            rich_charID = character.characterID
Ejemplo n.º 3
0
def main(args):
    eveapi.set_user_agent("eveapi.py/1.3")
    api = eveapi.EVEAPIConnection()
    auth = api.auth(keyID=YOUR_KEYID, vCode=YOUR_VCODE)
    result = auth.account.Characters()

    charnum = choosen(result.characters)

    ret = auth.character(result.characters[charnum].characterID)
    sheet = ret.CharacterSheet()

    print(sheet.name)
Ejemplo n.º 4
0
import time
import tempfile
import pickle
import zlib
import os
from os.path import join, exists

import eveapi

# Put your userID and apiKey (full access) here before running this script.
YOUR_KEYID = 123456
YOUR_VCODE = "nyanyanyanyanyanyanyanyanyanyanyanyanyanyanyanyanyanya:3"

# Provide a good User-Agent header
eveapi.set_user_agent("eveapi.py/1.3")

api = eveapi.EVEAPIConnection()

# ----------------------------------------------------------------------------
print()
print("EXAMPLE 1: GETTING THE ALLIANCE LIST")
print(" (and showing alliances with 1000 or more members)")
print()

# Let's get the list of alliances.
# The API function we need to get the list is:
#
#    /eve/AllianceList.xml.aspx
#
# There is a 1:1 correspondence between folders/files and attributes on api
Ejemplo n.º 5
0
#logging.basicConfig(filename='eve-first_transactions.log',level=logging.DEBUG)
#Row(name:Flicky G,characterID:859818750,corporationName:Flicky G Corporation,corporationID:98436502,allianceID:0,allianceName:,factionID:0,factionName:)

#'EVE API Stuff
CHAR_KEYID = 4958524
CHAR_VCODE = "njXdwQdNFNlf47TfOAnbNuHP6gX7sJeArgD2AEk1Qpay1tkUagUMyStSriZPQqd0"
CHAR_AMASK = 1073741823


#Corp
CORP_KEYID = 1383071
CORP_VCODE = "m0ecx5e1r8RCMsizNKXyB91HQchkHjJmNJlG8or0xy3VvkpiAJj1J7wXb70lUMm0"
CORP_AMASK = 268435455


eveapi.set_user_agent("eveapi.py/1.3")
api = eveapi.EVEAPIConnection()


class MyCacheHandler(object):
    # Note: this is an example handler to demonstrate how to use them.
    # a -real- handler should probably be thread-safe and handle errors
    # properly (and perhaps use a better hashing scheme).

    def __init__(self, debug=False):
        self.debug = debug
        self.count = 0
        self.cache = {}
        self.tempdir = join(tempfile.gettempdir(), "eveapi")
        if not exists(self.tempdir):
            os.makedirs(self.tempdir)
Ejemplo n.º 6
0
# This is a url where the most recent plugin package can be downloaded.
__url__ = ''  # 'http://supybot.com/Members/yourname/EVESpai/download'

import config
import plugin
reload(plugin)  # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded.  Don't forget to import them as well!
import psycopg2
import psycopg2.pool
reload(psycopg2)
reload(psycopg2.pool)
import psycopg2.extras
reload(psycopg2.extras)
import eveapi
reload(eveapi)
try:
    eveapi.set_user_agent('EVESpai//vittoros@#eve-dev')
except:
    pass
import datetime
reload(datetime)

if world.testing:
    import test

Class = plugin.Class
configure = config.configure

# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
Ejemplo n.º 7
0
 def __init__(self):
     eveapi.set_user_agent("eveapi.py/1.3")
     self.xmlapi = eveapi.EVEAPIConnection()
Ejemplo n.º 8
0
    """Attempts to cast an XML string to the most probable type."""
    cast_funcs = (
        lambda x: datetime.datetime.strptime(x, "%Y-%m-%d %H:%M:%S"),
        int,
        float)

    for f in cast_funcs:
        try:
            return f(value)
        except ValueError:
            pass

    return value  # couldn't cast. return string unchanged.

eveapi.set_cast_func(eveapi_cast_func)
eveapi.set_user_agent("twitter:@_scruff")


# === eve pycrest stuff
if not os.path.exists(app.config['CREST_CACHE_DIR']):
    os.mkdir(app.config['CREST_CACHE_DIR'])

import cache
c = cache.FileCache(app.config['CREST_CACHE_DIR'])

eve = pycrest.EVE(
    client_id=app.config['CREST_CLIENT_ID'],
    api_key=app.config['CREST_SECRET_KEY'],
    redirect_uri=app.config['CREST_CALLBACK_URL'],
    cache=c)
eve()  # initialize
Ejemplo n.º 9
0
import sys
import pprint
import yaml
import eveapi
from cache import MyCacheHandler

eveapi.set_user_agent('Armada prober//Vittoros@#eve-dev')


def probe(keys, endpoints):
    output = {}

    for namespace in ('Corp', 'Char'):
        api = eveapi.EVEAPIConnection(cacheHandler=MyCacheHandler(debug=False))
        auth = api.auth(keyID=keys[namespace]['keyID'],
                        vCode=keys[namespace]['vCode'])
        characterID = keys[namespace]['characterID']
        output[namespace] = {}
        for endpoint in endpoints[namespace]:
            sys.stderr.write('Probing %s %s\n' % (namespace, endpoint))
            if len(endpoints[namespace][endpoint]['keys']) > 1:
                continue
            output[namespace][endpoint] = {}
            try:
                #FIXME: should use keys from endpoints to determine what parameters to pass
                res = getattr(getattr(auth, namespace),
                              endpoint)(characterID=characterID)
            except Exception, e:
                sys.stderr.write('%s: %s\n' % (endpoint, e))
                output[namespace][endpoint] = '#FIXME'
                continue
Ejemplo n.º 10
0
    signal.signal(signal.SIGTERM, _onTermSignal)

    # create and install asyncio main event loop
    # http://www.tornadoweb.org/en/stable/asyncio.html#tornado.platform.asyncio.AsyncIOMainLoop
    AsyncIOMainLoop().install()

    # advanced python scheduler for reoccuring tasks as defined by modules
    _scheduler = AsyncIOScheduler() #TornadoScheduler()

    # reload settings periodically
    _scheduler.add_job(settings.load_settings, 'interval', minutes=5)

    # add eve user and url of your application here
    import eveapi
    if 'in_game_owner' in cfgServer:
        eveapi.set_user_agent('Host: %s; Admin-EVE-Character: %s' % ('dev-local', cfgServer['in_game_owner']))

    # init universe data from SDE
    asyncio.get_event_loop().run_until_complete(universe.initCaches())

    # only import at this point to make sure all required modules have already been loaded
    from igbtoolbox import pages

    # default routes
    urls = []

    if settings.DEBUG:
        urls.append((r"/static/bower_components/(.*)", tornado.web.StaticFileHandler, {"path": path.join(path.dirname(__file__), '..', '..', 'bower_components')}))

    urls.extend([
            (r"/static/common/(.*)", tornado.web.StaticFileHandler, {"path": path.join(path.dirname(__file__), '..', '..', 'web')}),
Ejemplo n.º 11
0
import sys
import pprint
import yaml
import eveapi
from cache import MyCacheHandler

eveapi.set_user_agent('Armada prober//Vittoros@#eve-dev')

def probe(keys, endpoints):
    output = {}

    for namespace in ('Corp','Char'):
        api = eveapi.EVEAPIConnection(cacheHandler=MyCacheHandler(debug=False))
        auth = api.auth(keyID=keys[namespace]['keyID'], vCode=keys[namespace]['vCode'])
        characterID = keys[namespace]['characterID']
        output[namespace] = {}
        for endpoint in endpoints[namespace]:
            sys.stderr.write('Probing %s %s\n' % (namespace, endpoint))
            if len(endpoints[namespace][endpoint]['keys']) > 1:
                continue
            output[namespace][endpoint] = {}
            try:
                #FIXME: should use keys from endpoints to determine what parameters to pass
                res = getattr(getattr(auth, namespace), endpoint)(characterID=characterID)
            except Exception, e:
                sys.stderr.write('%s: %s\n' % (endpoint, e))
                output[namespace][endpoint] = '#FIXME'
                continue
            attributes = filter(lambda l: not l.startswith('_'), dir(res))
            for attribute in attributes:
                attribute_type = type(getattr(res, attribute)).__name__