Scrapnot

testing

this is heading 3

blah blah blah

This is a scrapbook for exploring some python ideas and modules that i plan to take into other notebooks. Test! What I really need to start doing with these notebooks is a daily notebook. At the end of the week the blog .


In [67]:
import markdown

In [68]:
import requests
import json
import xmltodict

In [76]:
hcpux = requests.get('http://feeds.feedburner.com/HamiltonComputerClub?format=xml')

In [77]:
cerz = hcpux.text

In [77]:


In [78]:
hamx = xmltodict.parse(cerz)

In [79]:
for ha in hamx['rss']['channel']:
    print ha


title
link
description
lastBuildDate
language
sy:updatePeriod
sy:updateFrequency
generator
atom10:link
feedburner:info
feedburner:browserFriendly
item

In [92]:
staz = hamx['rss']['channel']

In [93]:
alket = staz.keys()

In [94]:
len(alket)


Out[94]:
12

In [95]:
savlis = []

In [96]:
print alket[3]


lastBuildDate

In [97]:
savcal = staz.values

In [ ]:


In [98]:
savcal()[0:7]


Out[98]:
[u'Hamilton Computer Club',
 u'http://hamiltoncomputerclub.org.nz',
 u'Exchange information and share skills',
 u'Thu, 01 May 2014 10:20:40 +0000',
 u'en-US',
 u'hourly',
 u'1']

In [87]:
for ket in alket:
    #print staz[ket]
    print staz['title']
    savlis.append(staz[ket])


Hamilton Computer Club
Hamilton Computer Club
Hamilton Computer Club
Hamilton Computer Club
Hamilton Computer Club
Hamilton Computer Club
Hamilton Computer Club
Hamilton Computer Club
Hamilton Computer Club
Hamilton Computer Club
Hamilton Computer Club
Hamilton Computer Club

In [88]:
opd = json.dumps(hamxy)


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-88-470a3306a967> in <module>()
----> 1 opd = json.dumps(hamxy)

NameError: name 'hamxy' is not defined

In [89]:
savopd = open('cpuclu.json', 'w')

In [90]:
savopd.write(opd)


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-90-b9cbea379c27> in <module>()
----> 1 savopd.write(opd)

NameError: name 'opd' is not defined

In [ ]:
savopd.close()

In [ ]:
zopa = open('cpuclu.json', 'r')

In [ ]:
print zopa.read()

In [ ]:
myjson = zopa.read()

In [ ]:
sjson = json.dumps(hamx)

In [ ]:
print sjson

In [ ]:
cerz

In [ ]:
markdown.to_html_string('*testing one two three*')

In [ ]:
html = markdown.markdown('testing123!')

In [ ]:
print html

In [70]:
import os

In [71]:
posfol = ("/home/will/hamiiltoncomputerclub.org.nz/static/posts")
blotil = ("wcmckee")

In [72]:
os.makedirs(posfol)

In [72]:


In [73]:
ls


~/                                     dh.py                oceanconnor.ipynb  README.md       testing123
aklmcam.ipynb                          example.xls          prnsav             redTube.py      tlchome.html
aklmcam.py                             hcpux                pyblen.py          redTube.pyc     tlc.ipynb
artcontrol.ipynb                       home.html            pynztacam.ipynb    result          tlc.py
artcontrolme.wordpress.2014-02-10.xml  ipython_log.py       pynztacam.py       salecus.ipynb   tpb.ipynb
artcontrol.py                          ipython_log.py.001~  pyssh.ipynb        salecus.py      Untitled0.ipynb
config                                 ipython_log.py.002~  pyssh.py           salecus.pyc     uploads.html
cpuclu.json                            LICENSE              pywgit.ipynb       savPrn          wcmckee.rst
dhcpd.leases                           linkz                pywgit.py          scrapnot.ipynb
dh.ipynb                               myfile.txt           pywgitz.py         scrapnot.py

In [74]:
rstz = open((blotil + '.rst'), 'w')

In [75]:
rstz.write('


  File "<ipython-input-75-0019d967869f>", line 1
    rstz.write('
               ^
SyntaxError: EOL while scanning string literal

In [ ]:


In [ ]:
conv = markdown.markdownFromFile

In [ ]:
import pandoc

In [ ]:
pandoc.PANDOC_PATH = ('/usr/bin/pandoc')

In [ ]:
panout = pandoc.Document.OUTPUT_FORMATS

In [ ]:
for pa in panout:
    print pa

In [ ]:
panin = pandoc.Document.INPUT_FORMATS

In [ ]:
panin

In [ ]:
for nai in panin:
    print nai

In [ ]:
nai

In [ ]:
doc = pandoc.Document()
doc.markdown = '''
# I am a tag

*omg this is a test!

[artcontrol](https://artcontrol.me)
'''

In [ ]:
print doc.html

In [ ]: