summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2012-02-12 12:25:03 +0100
committerFlorian Bruhin <me@the-compiler.org>2012-02-12 12:25:03 +0100
commitebc4ac70b483119be0a045df57b8616859bc2d8c (patch)
treee357d92888650cee64399f25734a35a7e99c732e
parentf7c9bbce28202d48a9be6ff190ad93e53bf20868 (diff)
downloadwebopac-ebc4ac70b483119be0a045df57b8616859bc2d8c.tar.gz
webopac-ebc4ac70b483119be0a045df57b8616859bc2d8c.zip
filehandling
-rw-r--r--webopac.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/webopac.py b/webopac.py
index c992ec4..4eeabd9 100644
--- a/webopac.py
+++ b/webopac.py
@@ -8,7 +8,6 @@ import logging
import optparse
def get_webopac_xml(query, baseurl):
-
cj = http.cookiejar.CookieJar()
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))
assert(isinstance(query, str))
@@ -65,10 +64,15 @@ def init():
initlog(options)
return (options, args)
+def writefile(infile, path='/home/florian/webopac.xml')
+ with open(path, 'w') as outfile:
+ outfile.write(infile.read()
+
def main():
(options, args) = init()
f = get_webopac_xml(args[0], baseurl=options.baseurl)
root = decode_xml(f)
+ f.close()
print(root)
if __name__ == '__main__':