当前位置: 首页>>代码示例>>Python>>正文


Python listing.Listing类代码示例

本文整理汇总了Python中listing.Listing的典型用法代码示例。如果您正苦于以下问题:Python Listing类的具体用法?Python Listing怎么用?Python Listing使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Listing类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

def main():
  (opts, args) = cli()
  key = get_value('key')
  td = Tmdb(key, opts.category)
  if opts.listing:
    li = Listing(opts.category)
    movies = li.get_movies()
    prefix = "list_"
    subject = "Week %s: %s" % (THIS_WEEK, li.title)
  else:
    movies = td.get_movies(opts.numres) 
    prefix = ""
    subject = "%s movies - week %s" % (opts.category.title().replace("_", " "), THIS_WEEK)
  ca = Cache(prefix + os.path.basename(opts.category))
  newMovies = ca.shelve_results(movies)
  if opts.listing:
    movieObjects = ca.shelve_get_items(movies) # allow dups
  else:
    movieObjects = ca.shelve_get_items(newMovies) # only new ones
  op = Output(movieObjects)
  html = [op.generate_header()]
  html.append(op.generate_movie_html_div())
  if opts.printres:
    print "\n".join(html)
  if opts.mailres:
    sender = get_value('sender')
    recipients = load_emails('recipients')
    ma = Mail(sender)
    ma.mail_html(recipients, subject, "\n".join(html))
开发者ID:bbelderbos,项目名称:themoviedb,代码行数:29,代码来源:main.py

示例2: empty_listing

def empty_listing(*things):
    parent_name = None
    for t in things:
        try:
            parent_name = t.parent_name
            break
        except AttributeError:
            continue
    l = Listing(None, None, parent_name = parent_name)
    l.things = list(things)
    return Wrapped(l)
开发者ID:TalkativeTree,项目名称:reddit,代码行数:11,代码来源:builder.py

示例3: collect_page_results

	def collect_page_results(self, store):
			names = self.driver.find_elements_by_xpath('//a[@name="listpage_productname"]')
			model_numbers = self.driver.find_elements_by_xpath('//ul[@class="productInfo"]/li[@class="last"]')
			item_numbers = self.driver.find_elements_by_xpath('//ul[@class="productInfo"]/li[not(@class="last")]')
			prices = self.driver.find_elements_by_xpath('//p[@class="pricing"]/strong')
			self.load_next_check = model_numbers[0].text[9:]
			page_results = []
			for i in range(0, len(names)):
				listing = Listing()
				listing.name = names[i].text
				listing.item_number = item_numbers[i].text[8:]
				listing.model_number = model_numbers[i].text[9:]
				listing.price = prices[i].text[1:]
				listing.country = store.country
				listing.state = store.state
				listing.town = store.town
				listing.store_number = store.store_number
				listing.address = store.address
				page_results.append(listing)
			return page_results
开发者ID:MohanL,项目名称:Python-Webscraping,代码行数:20,代码来源:lowes_automator.py

示例4: parse_node

def parse_node(node):
    children = itol(node.children)

    listing = Listing()

    try:

        # first row
        chillen = itol(children[0])
        listing.mls = chillen[0].find_all(text=re.compile('\d{8}'))[0].strip()
        listing.status = parse_string(chillen[1], 'Status: ')
        ginz = chillen[2].find_all(text=re.compile('\d*'))
        listing.dom = int(ginz[1].strip())
        listing.dto = int(ginz[3].strip())
        listing.sale_price = parse_money(chillen[3], 'Sale Price: ')
        listing.list_price = parse_money(chillen[4], 'List Price: ')

        # second row
        in_ = itol(children[1])
        address1 = in_[0].getText()
        listing.price_sqft_list = Money(str(parse_sqft(in_[1])), 'USD')
        listing.sale_date = parse_date(in_[2])
        listing.list_date = parse_date(in_[3])

        # third row
        da = itol(children[3])
        address2 = da[0].getText()
        listing.address = address1 + ' ' + address2
        listing.price_sqft_sold = Money(str(parse_sqft(da[1])), 'USD')
        listing.off_mkt_date = parse_date(da[2])
        listing.orig_price = parse_money(da[3], 'Orig. Price:  ')

        # fourth row
        club = itol(children[4])
        listing.style = parse_string(club[0], 'Style: ')
        listing.outdoor_space = parse_string(club[1], 'Outdoor Space: ')
        listing.assoc_fee = parse_money(club[2], 'Assoc.Fee: ')

        # fifth row
        bottle = itol(children[6])
        listing.rooms = parse_int(bottle[0], 'Rooms: ')
        listing.beds = parse_int(bottle[1], 'Beds: ')
        listing.baths = parse_string(bottle[2], 'Baths: ')
        listing.living_area = parse_int(bottle[3], 'Living Area: ')
        listing.tax = parse_money(bottle[4], 'Tax: ')

        # sixth row
        full = itol(children[8])
        listing.garage = parse_int(full[0], 'Garage: ')
        listing.parking = parse_int(full[1], 'Parking: ')
        listing.pets = parse_string(full[2], 'Pets: ')
        listing.year_built = parse_int(full[3], 'Year Built: ')
        listing.fy = parse_int(full[4], 'Fy: ')

        # seventh row
        of_bub = itol(children[10])
        listing.remarks = parse_string(of_bub[0], 'Remarks: ')
    except:
        # I'm a monster
        listing.remarks = u''
        pass

    return listing
开发者ID:njason,项目名称:diginic,代码行数:63,代码来源:parse.py


注:本文中的listing.Listing类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。