def update_market_order_data(sql_session, region): eve = CrestConnection() crest_items = MarketOrder.get_objects_from_crest(eve, region=region) for item in crest_items: i = True if Item.get_from_db_by_id(sql_session, item.type) is None: try: i = Item.get_crest_item_by_attr(eve, 'id', item.type) Item.create_from_crest_data(sql_session, i, write=True) i = True except ValueError: i = False if i: MarketOrder.create_from_crest_data(sql_session, item, write=True)
def test_write_all_market_order_data(self): # There's a chance this test can fail due to timing issues Scraper.update_market_order_data(self._connection.session, self.region) crest_items = MarketOrder.get_objects_from_crest(self.eve, region=self.region) for item in crest_items: if Item.get_from_db_by_id(self._connection.session, item.type) is not None: self.assertTrue(MarketOrder.is_crest_item_in_db(self._connection.session, item))
def setUpClass(cls): cls.eve = CrestConnection() cls._connection = SqlConnection() cls._connection.create_tables() cls._connection.start_connection() cls.item = Item.get_from_db_or_crest_by_name(cls._connection.session, cls.eve, cls.ITEM_NAME) cls.region = Region.get_from_db_or_crest_by_name(cls._connection.session, cls.eve, cls.REGION_NAME) Scraper.update_market_day_data(cls._connection.session, cls.region, cls.item)
def setUpClass(cls): super().setUpClass() cls._connection.start_connection() item = Item.get_from_db_or_crest_by_name(cls._connection.session, cls.eve, cls.ITEM_NAME) region = Region.get_from_db_or_crest_by_name(cls._connection.session, cls.eve, cls.REGION_NAME) Scraper.update_market_day_data(cls._connection.session, region, item)
def setUp(self): super().setUp() self.item = Item.get_from_db_or_crest_by_name(self._connection.session, self.eve, self.ITEM_NAME) self.region = Region.get_from_db_or_crest_by_name( self._connection.session, self.eve, self.REGION_NAME) self.crest_kwargs = { "item": self.item, "region": self.region, }
def get_items(sql_session, crest_connection): items = [] for item in ITEM_NAMES: items += [Item.get_from_db_or_crest_by_name(sql_session, crest_connection, item)] return items
def setUp(self): self._connection = SqlConnection() self._connection.create_tables() self._connection.start_connection() self.item = Item.get_from_db_or_crest_by_name(self._connection.session, self.eve, self.ITEM_NAME) self.region = Region.get_from_db_or_crest_by_name(self._connection.session, self.eve, self.REGION_NAME)
def setUp(self): super().__init__() self.item = Item.get_from_db_or_crest_by_name(self._connection.session, self.eve, self.ITEM_NAME) self.region = Region.get_from_db_or_crest_by_name( self._connection.session, self.eve, self.REGION_NAME)