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 [103]:
staz


Out[103]:
OrderedDict([(u'title', u'Hamilton Computer Club'), (u'link', u'http://hamiltoncomputerclub.org.nz'), (u'description', u'Exchange information and share skills'), (u'lastBuildDate', u'Thu, 01 May 2014 10:20:40 +0000'), (u'language', u'en-US'), (u'sy:updatePeriod', u'hourly'), (u'sy:updateFrequency', u'1'), (u'generator', u'http://wordpress.org/?v=3.9.1'), (u'atom10:link', [OrderedDict([(u'@xmlns:atom10', u'http://www.w3.org/2005/Atom'), (u'@rel', u'self'), (u'@type', u'application/rss+xml'), (u'@href', u'http://feeds.feedburner.com/HamiltonComputerClub')]), OrderedDict([(u'@xmlns:atom10', u'http://www.w3.org/2005/Atom'), (u'@rel', u'hub'), (u'@href', u'http://pubsubhubbub.appspot.com/')])]), (u'feedburner:info', OrderedDict([(u'@uri', u'hamiltoncomputerclub')])), (u'feedburner:browserFriendly', None), (u'item', [OrderedDict([(u'title', u'Windows RIP XP Long live 8.1'), (u'link', u'http://hamiltoncomputerclub.org.nz/windows-rip-xp-long-live-8-1/'), (u'comments', u'http://hamiltoncomputerclub.org.nz/windows-rip-xp-long-live-8-1/#comments'), (u'pubDate', u'Wed, 09 Apr 2014 21:38:34 +0000'), (u'dc:creator', u'Rod Aldridge'), (u'category', u'Link dump'), (u'guid', OrderedDict([(u'@isPermaLink', u'false'), ('#text', u'http://hamiltoncomputerclub.org.nz/?p=417')])), (u'description', u'Microsoft makes Windows free for select devices, announces universal Windows apps By Shawn Knight on April 2, 2014 http://www.techspot.com/news/56240-microsoft-makes-windows-free-for-select-devices-announces-universal-windows-apps.html Microsoft on Wednesday revealed plans to make Windows free for manufacturers to use on smartphones and tablets with screen sizes under nine inches. Furthermore, a future version of Windows for the \u2026 <a href="http://hamiltoncomputerclub.org.nz/windows-rip-xp-long-live-8-1/"> Continue reading <span class="meta-nav">&#8594; </span></a>'), (u'wfw:commentRss', u'http://hamiltoncomputerclub.org.nz/windows-rip-xp-long-live-8-1/feed/'), (u'slash:comments', u'0')]), OrderedDict([(u'title', u'Python'), (u'link', u'http://hamiltoncomputerclub.org.nz/python/'), (u'comments', u'http://hamiltoncomputerclub.org.nz/python/#comments'), (u'pubDate', u'Fri, 21 Mar 2014 12:49:39 +0000'), (u'dc:creator', u'wcmckee'), (u'category', [u'Software', u'code', u'python', u'teach']), (u'guid', OrderedDict([(u'@isPermaLink', u'false'), ('#text', u'http://hamiltoncomputerclub.org.nz/?p=391')])), (u'description', u'My name is William Mckee. I did a talk in February regarding the Python programming language. I found Bruce through the New Zealand Python users group mailing list. There had been much discussion in the post regarding getting some Python meetups/classes happen. Auckland, Wellington, and Christchurch have monthly Python meetups. \u2026 <a href="http://hamiltoncomputerclub.org.nz/python/"> Continue reading <span class="meta-nav">&#8594; </span></a>'), (u'wfw:commentRss', u'http://hamiltoncomputerclub.org.nz/python/feed/'), (u'slash:comments', u'0')]), OrderedDict([(u'title', u'Beware fake-capacity USB drives'), (u'link', u'http://hamiltoncomputerclub.org.nz/350/'), (u'comments', u'http://hamiltoncomputerclub.org.nz/350/#comments'), (u'pubDate', u'Mon, 21 Oct 2013 07:48:44 +0000'), (u'dc:creator', u'Bruce Kingsbury'), (u'category', u'Security'), (u'guid', OrderedDict([(u'@isPermaLink', u'false'), ('#text', u'http://hamiltoncomputerclub.org.nz/?p=350')])), (u'description', u'Various Trademe members have comment that there are listings for very cheap 128GB, 256GB and 512GB USB Memory Keys appearing on the site. Please be aware that there is a large number of fake USB Memory Keys being sold on eBay in the USA and from China which the firmware \u2026 <a href="http://hamiltoncomputerclub.org.nz/350/"> Continue reading <span class="meta-nav">&#8594; </span></a>'), (u'wfw:commentRss', u'http://hamiltoncomputerclub.org.nz/350/feed/'), (u'slash:comments', u'0')]), OrderedDict([(u'title', u'Found on the web 2013/10'), (u'link', u'http://hamiltoncomputerclub.org.nz/201310/'), (u'comments', u'http://hamiltoncomputerclub.org.nz/201310/#comments'), (u'pubDate', u'Mon, 30 Sep 2013 00:42:11 +0000'), (u'dc:creator', u'Rod Aldridge'), (u'category', u'Link dump'), (u'guid', OrderedDict([(u'@isPermaLink', u'false'), ('#text', u'http://hamiltoncomputerclub.org.nz/?p=307')])), (u'description', u'Some items which you may find interesting or useful Some HOWTO&#8217;s and other hints mostly from PC World, some security and privacy alerts, software, some general news, Microsoft news, insight into censorship in China, explanation of Application Programming Interfaces (APIs) and Encryption. Finally some light relief (this year&#8217;s IgNoble Prizes). \u2026 <a href="http://hamiltoncomputerclub.org.nz/201310/"> Continue reading <span class="meta-nav">&#8594; </span></a>'), (u'wfw:commentRss', u'http://hamiltoncomputerclub.org.nz/201310/feed/'), (u'slash:comments', u'0')]), OrderedDict([(u'title', u'Potential NSA Involvement in a NIST RNG Standard'), (u'link', u'http://hamiltoncomputerclub.org.nz/potential-nsa-involvement-in-a-nist-rng-standard/'), (u'comments', u'http://hamiltoncomputerclub.org.nz/potential-nsa-involvement-in-a-nist-rng-standard/#comments'), (u'pubDate', u'Mon, 30 Sep 2013 00:22:02 +0000'), (u'dc:creator', u'Bruce Kingsbury'), (u'category', u'Tidbits'), (u'guid', OrderedDict([(u'@isPermaLink', u'false'), ('#text', u'http://hamiltoncomputerclub.org.nz/?p=296')])), (u'description', u'In August 2007, a young programmer in Microsoft\u2019s Windows security group stood up to give a five-minute turbo talk at the annual Crypto conference in Santa Barbara. It was a Tuesday evening, part of the conference\u2019s traditional rump session, when a hodge-podge of short talks are presented outside of the \u2026 <a href="http://hamiltoncomputerclub.org.nz/potential-nsa-involvement-in-a-nist-rng-standard/"> Continue reading <span class="meta-nav">&#8594; </span></a>'), (u'wfw:commentRss', u'http://hamiltoncomputerclub.org.nz/potential-nsa-involvement-in-a-nist-rng-standard/feed/'), (u'slash:comments', u'0')]), OrderedDict([(u'title', u'New website and blogs'), (u'link', u'http://hamiltoncomputerclub.org.nz/new-website-blogs/'), (u'comments', u'http://hamiltoncomputerclub.org.nz/new-website-blogs/#comments'), (u'pubDate', u'Tue, 17 Sep 2013 12:26:55 +0000'), (u'dc:creator', u'Virginia Schnauer'), (u'category', [u'Notices', u'website']), (u'guid', OrderedDict([(u'@isPermaLink', u'false'), ('#text', u'http://hamiltoncomputerclub.org.nz/?p=231')])), (u'description', u'I met with Bruce today and have cleaned up some loose end on your new look website. Members can now become contributors or post comments and have conversations. I suggest you all start here by commenting your likes and dislikes regarding look, format and content. It would be great to \u2026 <a href="http://hamiltoncomputerclub.org.nz/new-website-blogs/"> Continue reading <span class="meta-nav">&#8594; </span></a>'), (u'wfw:commentRss', u'http://hamiltoncomputerclub.org.nz/new-website-blogs/feed/'), (u'slash:comments', u'1')]), OrderedDict([(u'title', u'PC World Magazine'), (u'link', u'http://hamiltoncomputerclub.org.nz/pc-world-magazine/'), (u'comments', u'http://hamiltoncomputerclub.org.nz/pc-world-magazine/#comments'), (u'pubDate', u'Sat, 14 Sep 2013 09:24:32 +0000'), (u'dc:creator', u'Virginia Schnauer'), (u'category', [u'Tidbits', u'IT', u'magazines']), (u'guid', OrderedDict([(u'@isPermaLink', u'false'), ('#text', u'http://hamiltoncomputerclub.org.nz/?p=190')])), (u'description', u'End of a era PC World magazine has closed down. It is available online http://www.pcworld.co.nz/. The site now offers sections on smartphones and tablets, computers, gadgets, a business centre, home entertainment, cameras, and a forum It is intended for the IT trade publications to continue.'), (u'wfw:commentRss', u'http://hamiltoncomputerclub.org.nz/pc-world-magazine/feed/'), (u'slash:comments', u'0')]), OrderedDict([(u'title', u'First article'), (u'link', u'http://hamiltoncomputerclub.org.nz/first-article/'), (u'comments', u'http://hamiltoncomputerclub.org.nz/first-article/#comments'), (u'pubDate', u'Sun, 01 Sep 2013 11:06:21 +0000'), (u'dc:creator', u'Bruce Kingsbury'), (u'category', [u'Notices', u'website']), (u'guid', OrderedDict([(u'@isPermaLink', u'false'), ('#text', u'http://hamiltoncomputerclub.org.nz/?p=49')])), (u'description', u'This is the new website of the Hamilton PC computer club. It&#8217;s registered and hosted on wordpress by onlydomains.com. The theme at time or writing is wp386, a throwback to the old BBS days. I&#8217;m sure everybody on the committee is going to absolutely loath it which should encourage them \u2026 <a href="http://hamiltoncomputerclub.org.nz/first-article/"> Continue reading <span class="meta-nav">&#8594; </span></a>'), (u'wfw:commentRss', u'http://hamiltoncomputerclub.org.nz/first-article/feed/'), (u'slash:comments', u'3')])])])

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 [ ]: