乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      真正的Web2.0:書簽?標記?_Web服務(wù)技巧_Web2.0_TechTarget IT...

       weicat 2007-08-03
      本土方法

        您可能只是對門面仰慕已久,而在 Web 2.0 站點的某些點上,您會尋求某些工具,用甚至站點創(chuàng)建者都沒有預(yù)見到的方法獲得站點功能。對于 del. 來說,有很多這樣的工具。開始時,站點的創(chuàng)建者提供他們自己的一些工具,從可用于在其他站點上顯示您網(wǎng)絡(luò)中的帖子的標記到瀏覽器工具欄。此外,一百多個第三方工具覆蓋了您能想像到的 del. 的大多數(shù)用途,大多數(shù),但并非全部,所以可以這樣歸納,Web 2.0 站點的重要性就在于您可以突破編譯器或解釋程序,創(chuàng)建您自己的特性。

        Web 提要:便宜的 API

        del. 的官方 API 使用 HTTP 以及 SSL 和身份驗證。但是如果您只需要讀訪問,那么可以選擇整體上采用 Web 2.0 的更為官方的 API:Web 提要。您可以訪問用戶(http://del./rss/<username>)、標記(http://del./rss/<tag>)或者兩者組合(http://del./rss/<username>/<tag>)的 Web 提要。那么問題只在于解析 Web 提要以提取所需信息。清單 1 提供了一個示例。它是 Python 代碼,該代碼發(fā)送包含前一天 del. 提要條目的電子郵件。

        清單 1. 用于發(fā)送前一天 del. 帖子的電子郵件的代碼

      import time
      import smtplib
      from email.MIMEText import MIMEText
      from datetime import date, timedelta

      import amara

      #The base URI for all tags
      TAGBASE = ‘http://del./tag/‘

      #Set FEEDS to customize which feeds you want to monitor
      FEEDS = [‘http://del./rss/uche‘, ‘http://del./rss/popular‘]

      FROM = ‘del.@example.com‘
      TO = ‘user@example.com‘
      SMTPHOST = ‘localhost‘

      #Compute the date string for yesterday in ISO-8601 format
      yesterday = (date(*time.gmtime()[:3]) - timedelta(1)).isoformat()

      message_text = u‘‘

      #Using Amara. Easy to just grab the RSS feed
      for feed in FEEDS:
          doc = amara.parse(feed)
          message_text += u‘\n‘ + unicode(doc.RDF.channel.title) + u‘\n\n‘
          current_items = [ item for item in doc.RDF.item
                            if unicode(item.date).startswith(yesterday) ]
          for item in current_items:
              #Get the properties of the link, defaulting to empty string
              title = unicode(getattr(item, ‘title‘, u‘‘))
              href = unicode(getattr(item, ‘link‘, u‘‘))
              desc = unicode(getattr(item, ‘description‘, u‘‘))
              creator = unicode(getattr(item, ‘creator‘, u‘‘))
              message_text += u‘<%s>--"%s" (from %s)\n‘%(href, title, creator)
              message_text += desc + ‘\n‘

      #Be sure to handle Unicode by encoding to UTF-8
      msg = MIMEText(message_text.encode(‘utf-8‘))

      #Set message metadata
      msg[‘Subject‘] = u‘del. bookmarks for %s\n‘ % yesterday
      msg[‘From‘] = FROM
      msg[‘To‘] = TO

      #Send the message via the specified SMTP server
      s = smtplib.SMTP()
      s.connect(SMTPHOST)
      #s.login(SMTP_USERNAME, SMTP_PASSWORD) #If login is necessary
      s.sendmail(FROM, [TO], msg.as_string())
      s.close()

        本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多