コード例 #1
0
ファイル: pipelines.py プロジェクト: 4bic-attic/scrape
	def __init__(self):

		"""
		Initializes database connection and sessionmaker.
		Creates deals table.
		"""

		engine = db_connect()
		create_deals_table(engine)
		self.Session = sessionmaker( bind = engine )

		def process_item(self, item, spider):
			"""Save deals in the database.

			This method is called for every item pipeline component.

			"""
			session = self.Session()
			deal = Deals(**item)

			try:
				session.add(deal)
				session.commit()
			except:
				session.rollback()
				raise
			finally:
				session.close()

				return item
コード例 #2
0
ファイル: pipelines.py プロジェクト: jasonlmann/new-coder
 def __init__(self):
     """Initializes database connection and sessionmaker.
     Creates deals table.
     """
     engine = db_connect()
     create_deals_table(engine)
     self.Session = sessionmaker(bind=engine)
コード例 #3
0
	def __init__(self):
		"""Initialize database connecton and sessionmaker
		Create deals table"""

		engine = db_connect()
		create_deals_table(engine)
		self.Session = sessionmaker(bind=engine)
コード例 #4
0
ファイル: pipelines.py プロジェクト: zawmoetun/oddsportal
 def __init__(self):
     """
     Initializes database connection and sessionmaker.
     Creates results table.
     """
     engine = db_connect()
     create_deals_table(engine)
     self.Session = sessionmaker(bind=engine)
コード例 #5
0
ファイル: pipelines.py プロジェクト: zelaznik/scratchpad
    def __init__(self):
        ''' Initializes db connection and session maker.
            Creates deals table.
        '''

        engine = db_connect()
        create_deals_table(engine)
        self.Session = sessionmaker(bind=engine)
コード例 #6
0
ファイル: pipelines.py プロジェクト: joshuaNewman10/new-coder
 def __init__(self):
   """
   Initialize database connection and sessionmaker
   Creates deals table
   """
   engine = db_connect()
   create_deals_table(engine)
   self.Session = sessionmaker(bind=engine) #binding/connection to db with the defined engine
コード例 #7
0
 def __init__(self, *args, **kwargs):
     engine = db_connect()
     create_deals_table(engine)
     session = sessionmaker(bind=engine)()
     self.listings = session.query(Idealista).all()
     session.close()
     locale.setlocale(locale.LC_TIME, "es_ES")
     super(IdealistaSpider, self).__init__(*args, **kwargs)
コード例 #8
0
	def __init__(self):
		"""
		Initializes the class by defining engine, deals table and connecting to db with defined engine.
		Creates deals table.
		"""
		engine = db_connect()
		create_deals_table(engine)
		self.Session = sessionmaker(bind=engine)
コード例 #9
0
 def __init__(self):
     """
     Initializes database connection and sessionmaker.
     Creates deals table.
     """
     engine = db_connect()
     create_deals_table(engine)
     self.Session = sessionmaker(bind=engine)
     zipDict = self.createZip()
     global zipDict
コード例 #10
0
 def __init__(self):
     """
     Initializes database connection and sessionmaker.
     Creates tables.
     """
     engine = db_connect()
     create_deals_table(engine)
     self.Session = sessionmaker(bind=engine)
     self.item = None
     self.listing = None
     self.existing_listing = None
コード例 #11
0
ファイル: pipelines.py プロジェクト: csd0429/mywork
 def __init__(self):                            #初始化连接mysql的数据库相关信息
     engine=db_connect()
     create_deals_table(engine)
     self.Session=sessionmaker(bind=engine)
コード例 #12
0
    def __init__(self):
        super(BodyWriterPipeline, self).__init__()

        engine = db_connect()
        create_deals_table(engine)
        self.Session = sessionmaker(bind=engine)
コード例 #13
0
 def __init__(self):
     self.file = open('dump1.jl','wb')
     engine = db_connect()
     
     create_deals_table(engine)
     self.Session = sessionmaker(bind=engine)
コード例 #14
0
ファイル: pipelines.py プロジェクト: Cheng-F/Python-Scrapy
    def __init__(self):

        engine = db_connect()
        create_deals_table(engine)
        self.Session = sessionmaker(bind=engine)
コード例 #15
0
ファイル: pipelines.py プロジェクト: AmosZ/taobao
 def __init__(self):
     engine = models.db_connect()
     models.create_deals_table(engine)
     self.Session = sessionmaker(bind=engine)
コード例 #16
0
    def __init__(self):
        self.file = open('dump1.jl', 'wb')
        engine = db_connect()

        create_deals_table(engine)
        self.Session = sessionmaker(bind=engine)
コード例 #17
0
    def __init__(self):
        super(BodyWriterPipeline, self).__init__()

        engine = db_connect()
        create_deals_table(engine)
        self.Session = sessionmaker(bind=engine)
コード例 #18
0
 def __init__(self):
     engine = create_engine(URL(**settings.DATABASE))
     create_deals_table(engine)
     self.Session = sessionmaker(bind=engine)