added ability to search for corps, chars and alliances.

This commit is contained in:
2018-04-25 15:57:11 +01:00
parent 3839235937
commit 9f5fe51c35
8 changed files with 200 additions and 5 deletions

67
eve_auth/data_classes.py Normal file
View File

@@ -0,0 +1,67 @@
from dateutil import parser
from dataclasses import dataclass
from datetime import datetime
import bleach
BLEACH_CONFIG = {
'tags': ['br', 'font', 'b', 'i', 'u', 'loc', 'a'],
'attributes': ['href']
}
@dataclass
class Alliance:
id: int
name: str
creator_id: int
creator_corporation_id: int
ticker: str
date_founded: datetime
executor_corporation_id: int
faction_id: int = None
def __post_init__(self):
if self.date_founded:
self.date_founded = parser.parse(self.date_founded)
@dataclass
class Corporation:
id: int
name: str
ticker: str
member_count: int
ceo_id: int
tax_rate: int
creator_id: int
description: str
date_founded: datetime
home_station_id: int
shares: int
alliance_id: int = None
faction_id: int = None
url: str = ''
def __post_init__(self):
if self.date_founded:
self.date_founded = parser.parse(self.date_founded)
self.description = bleach.clean(self.description, **BLEACH_CONFIG)
@dataclass
class Character:
id: int
corporation_id: int
name: str
gender: str
race_id: int
bloodline_id: int
description: str
ancestry_id: int
security_status: float
birthday: datetime
def __post_init__(self):
if self.birthday:
self.birthday = parser.parse(self.birthday)
self.description = bleach.clean(self.description, **BLEACH_CONFIG)