def load(title): cache = "data/" + title if not os.path.exists(cache): text = wp_query.wp_query(sys.argv[1]).get() print "Saving to cache" f = open(cache, "w") f.write(text) else: with open(cache) as f: print "Loading from cache" text = f.read() i = wp_info() i.infobox(text.split("\n")) return i.info
if DEBUG: print "[%d] %s" % (braces, line.lstrip()) self.info += line.lstrip() + "\n" if braces == 0: break # test cases TBD # Aerocar # GitHub # Heroku # Stack Overflow if __name__ == "__main__": if len(sys.argv) == 1: print "%s title" % (os.path.basename(__file__)) exit(1) if len(sys.argv) == 2: q = wp_query.wp_query(sys.argv[1]) i = wp_info() i.infobox(q.get().split("\n")) if not i.info: # try title case q = wp_query.wp_query(sys.argv[1].title()) i.infobox(q.get().split("\n")) print i.info, exit(0) else: print i.info, exit(0)