Skip to content

Commit

Permalink
trying unidecode for illegal chars
Browse files Browse the repository at this point in the history
  • Loading branch information
mobeets committed Feb 17, 2015
1 parent 9c71375 commit b45e446
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion requirements.txt
@@ -1,3 +1,4 @@
scraperwiki==0.3.11
python-dateutil==2.1
BeautifulSoup==3.2.1
BeautifulSoup==3.2.1
unidecode==0.04.16
3 changes: 2 additions & 1 deletion scraper.py
Expand Up @@ -6,6 +6,7 @@
import scraperwiki
from time import mktime
from dateutil import parser
from unidecode import unidecode
from BeautifulSoup import BeautifulSoup

BASE_URL = 'http://tinyletter.com/realfuture/letters/'
Expand Down Expand Up @@ -78,7 +79,7 @@ def load(url):

def prep_data(T):
data = []
cnv = lambda x: x.decode('utf-8') if type(x) is str else x
cnv = lambda x: unidecode(x.decode('utf-8') if type(x) is str else x)
for dt, ts in T:
for t in ts:
t.index = '{0}-{1}-{2}.{3}'.format(dt.year, dt.month, dt.day, t.number)
Expand Down

0 comments on commit b45e446

Please sign in to comment.