def build_html(): service = docs.setup_api_service() html = etree.fromstring(HTML_TEMPLATE) body = html.xpath("/x:html/x:body", namespaces=NSS)[0] the_google_docs = _collect_google_docs_inside_folder(service) first_doc_created_at = the_google_docs[0]['createdDate'] last_doc_created_at = the_google_docs[-1]['createdDate'] end_search_timestamp = _minutes_later(last_doc_created_at, num_minutes=5) tweet_search_results = tweets.hashtag_search_in_daterange(first_doc_created_at, end_search_timestamp) for i, child in enumerate(the_google_docs): log.info(u"Appending slide %s" % child['title']) slide = html5parser.fromstring(docs.export_file(service, child)) created_time = child['createdDate'] slide_body = slide.xpath("/x:html/x:body", namespaces=NSS)[0] the_slide_html_section = _generate_slide_html_section(slide_body, created_time, the_google_docs, i, tweet_search_results) body.append(the_slide_html_section) return html
import datetime import tweets start = datetime.datetime.strptime("2012-10-21T17:18:45.610Z", tweets.UNIX_TIMESTAMP).isoformat('T') end = datetime.datetime.strptime("2012-10-21T18:18:45.610Z", tweets.UNIX_TIMESTAMP).isoformat('T') tweets.hashtag_search_in_daterange(start, end)