This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
import re | |
import requests | |
from bottle import route, run, response | |
from bs4 import BeautifulSoup, Comment, Doctype | |
SITE_URL = 'http://habrahabr.ru' | |
HOST = 'localhost' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from shovel import task | |
@task | |
def hello(name): | |
print "Hello, %s!" % name | |
@task | |
def kwargs(**kwargs): | |
print "Kwargs: %s" % kwargs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def parse_schedule_page(content): | |
doc = lxml.html.document_fromstring(content) | |
rows = doc.xpath('//table[@class="reqform"]/tr/td') | |
print "Rows:", len(rows) | |
description = '' | |
if len(rows): | |
description = " ".join([line.text_content().strip() for line in rows[0].xpath('.//h3')]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# n) Something text or | |
# n) Right text* | |
match = re.match(r'^\w\)\s+(.[^\*]*)(\*?)$', line, re.UNICODE) | |
if match and len(match.groups()): | |
answer = dict(zip(['text','right'], [x for x in match.groups() if len(x)])) |
NewerOlder