我的腳本抓取rss頁面的內容獲取該頁面中的url將它們保存到列表中,然後抓取每個url的內容,並將該頁面的內容通過電子郵件發送給我。一切工作都非常好接受我無法發送列表中的每個鏈接。通常約有22個鏈接在列表中。我不想將多個鏈接的內容組合成一封電子郵件。如果我不加超時,我得到一個超過限額錯誤這樣谷歌應用程序引擎python超時發送電子郵件
<class 'google.appengine.runtime.apiproxy_errors.OverQuotaError'>: The API call mail.Send() required more quota than is available.
後,我補充說:「time.sleep(9)」慢下來它給了我這個錯誤。
<class 'google.appengine.runtime.DeadlineExceededError'>:
Traceback (most recent call last):
這是我的代碼..任何想法?
size = len(my_tabletest)
a=2
while a < size:
url = my_tabletest[a].split('html</link>')[0] + "print"
url_hhhhhh = urlfetch.fetch(url)
my_story = url_hhhhhh.content
my_story = my_story.split('<div class="printstory">')[1]
my_story_subject = my_story.split('<h1>')[1]
my_story_subject = my_story_subject.split('</h1>')[0]
my_story = ''.join(BeautifulSoup(my_story).findAll(text=True))
message = mail.EmailMessage(sender="me<[email protected]>",
subject=my_story_subject)
message.to = "Jim <[email protected]>"
message.body = my_story
message.html = my_story_html
message.send()
time.sleep(9)
a=a+1
您可能正在點擊[每分鐘配額](http://code.google.com/appengine/docs/quotas.html#Per-minute_Quotas)。我想Tasks API可能是一個解決方法,但我之前沒有使用過。在附註中,如果您正在進行大量手動RSS解析,請考慮使用[Feed Parser](http://www.feedparser.org/)。 – hyperslug 2011-05-01 01:07:14