In [1]:
#Dict is
#item product in dict. 'product' : 'internet'
#'count' : salesnum
#'tags' : tags to add
#Discount. add senior and under 18 prices.
#Read arcive folders
In [2]:
import os
import dominate
from dominate.tags import *
In [3]:
rarch = os.listdir('/home/wcmckee/sellcoffee/archive/')
In [4]:
rarch
Out[4]:
In [5]:
nevdict = dict()
In [13]:
#nevdict.update({
In [14]:
import json
In [ ]:
json.loads(rejd)
In [21]:
for rac in rarch:
rejs = open('/home/wcmckee/sellcoffee/archive/' + rac, 'r')
#print rac
recd = rejs.read()
jrecd = json.loads(recd)
print jrecd['product']
print jrecd['amount']
print jrecd['date']
print jrecd['time']
rejs.close()
In [19]:
jrecd.keys()
Out[19]:
In [20]:
jrecd.values()
Out[20]:
In [ ]:
In [ ]:
doc = dominate.document(title='Sales Archive')
with doc.head:
link(rel='stylesheet', href='style.css')
script(type ='text/javascript', src='script.js')
#str(str2)
with div():
attr(cls='header')
h1('Sales Archive')
p(img('/imgs/getsdrawn-bw.png', src='/imgs/getsdrawn-bw.png'))
#p(img('imgs/15/01/02/ReptileLover82-reference.png', src= 'imgs/15/01/02/ReptileLover82-reference.png'))
h1('Date ', str(artes.datetime))
#p(panz)
#p(bodycom)
with doc:
with div(id='body').add(ol()):
for rac in rarch:
rejs = open('/home/wcmckee/sellcoffee/archive/' + rac, 'r')
#print rac
recd = rejs.read()
jrecd = json.loads(recd)
p(jrecd['product'])
p(jrecd['amount'])
p(jrecd['date'])
p(jrecd['time'])
rejs.close()
#for flc in fulcom:
#p(h1(flc.title))
#p(img(imlocdir, src= imlocdir))
#p(img(flc.url, src = flc.url))
#p(str(flc.author))
#res = requests.get(flc.url, stream=True)
#with open(str(flc.author) + '-' + str(artes.date()) + '-reference.png', 'wb') as outfil:
# shutil.copyfileobj(res.raw, outfil)
# del res
#for flcz in flc.comments:
#p(flcz.body)
#for rdz in reliz:
#h1(rdz.title)
#a(rdz.url)
#p(img(rdz, src='%s' % rdz))
#print rdz
#p(img(rdz, src = rdz))
#p(rdz)
#print rdz.url
#if '.jpg' in rdz.url:
# img(rdz.urlz)
#else:
# a(rdz.urlz)
#h1(str(rdz.author))
#li(img(i.lower(), src='%s' % i))
with div():
attr(cls='body')
p('GotDrawn is open source')
a('https://github.com/getsdrawn/getsdrawndotcom')
a('https://reddit.com/r/redditgetsdrawn')
#print doc
In [ ]:
docre = doc.render()
#s = docre.decode('ascii', 'ignore')
yourstring = docre.encode('ascii', 'ignore').decode('ascii')
indfil = ('/home/wcmckee/gotdrawn/index.html')
mkind = open(indfil, 'w')
mkind.write(yourstring)
mkind.close()