示例#1
0
 def get_security(self):
     return esipy.EsiSecurity(
         # app=self.app,
         redirect_uri=settings.ESI_CALLBACK,
         client_id=settings.ESI_CLIENT_ID,
         secret_key=settings.ESI_SECRET_KEY,
         esi_datasource=getattr(settings, 'ESI_DATASOURCE', 'tranquility'),
         headers={'User-Agent': settings.ESI_USER_AGENT})
示例#2
0
    def _security(self):
        auth_details = dict(evetele.config.items('ESIAuth'))
        refresh_token = auth_details.pop('refresh_token', None)
        security = esipy.EsiSecurity(app=self._app,
                                     headers=self.headers,
                                     **auth_details)
        if refresh_token is None:
            self._authorise(security)

        else:
            security.update_token({
                'access_token': '',
                'expires_in': -1,
                'refresh_token': refresh_token
            })
            security.refresh()
        return security
示例#3
0
 def create_esi_security(self) -> esipy.EsiSecurity:
     return esipy.EsiSecurity(
         self.call_back,
         self.client_id,
         self.secret_key,
         headers={'User-Agent': 'Owned by Sajuukthanatoskhar'})
示例#4
0
文件: esi.py 项目: rudolfson/eve-sh
import string

import cherrypy
import click
import esipy

# On loading the module initialize the ESI Swagger App, Client and Security
if os.path.isfile('app.pickle'):
    with open('app.pickle', 'rb') as f:
        app = pickle.load(f)
else:
    app = esipy.App.create(url='https://esi.tech.ccp.is/latest/swagger.json?datasource=tranquility')
    with open('app.pickle', 'wb') as f:
        pickle.dump(app, f)
security = esipy.EsiSecurity(app=app, redirect_uri='http://localhost:7070/callback',
                             client_id='ca73ab1ab8a949518d8e9d35ea46d2d2',
                             secret_key='crLG9e6cQ7rYlDxgVZKEfH0yw2x3VFkUBPdy2MYb',
                             headers={'User-Agent': 'EVE CLI by Leonty Alkaev'})
client = esipy.EsiClient(security=security, headers={'User-Agent': 'EVE CLI by Leonty Alkaev'})

# Configure the callback server
# TODO switch to flask again and use the shutdown function, see http://flask.pocoo.org/snippets/67/
cherrypy.log.screen = None
cherrypy.log.logger_root = None
cherrypy.config.update({'server.socket_port': 7070})
cherrypy.config.update({'server.shutdown_timeout': 1})
cherrypy.config.update({'engine.autoreload.on': False})


class Authenticator(object):
    """Provide a callback to the authentication request and store the provided authentication data.