def main(): with environment(sys.argv) as env: for currency_pair in DBSession.query(CurrencyPair): print currency_pair.source, currency_pair.target with open( "%s-%s.txt" % (currency_pair.source, currency_pair.target), "w") as outfile: currency_pair_stats(outfile, currency_pair)
def main(): with environment(sys.argv) as env: try: tag_articles() transaction.commit() except: log.error(tb.format_exc()) transaction.abort() models.DBSession.close() log.info("End tagging")
def main(): with environment(sys.argv) as env: while True: try: fetch() transaction.commit() except: transaction.abort() log.error(tb.format_exc()) models.DBSession.close() time.sleep(30)
def main(): with environment(sys.argv) as env: for source, target in currency_pair_args: try: currency_pair = models.root[source, target] print "Found", source, target except KeyError: currency_pair = models.CurrencyPair(source, target, TEST_FEED_URL % {"source": source, "target": target}) models.DBSession.add(currency_pair) print "Created", source, target transaction.commit()
def main(): with environment(sys.argv) as env: for source, target in currency_pair_args: try: currency_pair = models.root[source, target] print "Found", source, target except KeyError: currency_pair = models.CurrencyPair( source, target, TEST_FEED_URL % { "source": source, "target": target }) models.DBSession.add(currency_pair) print "Created", source, target transaction.commit()
def main(): with environment(sys.argv) as env: while True: start_time = time.time() try: fetch() transaction.commit() except: transaction.abort() log.error(tb.format_exc()) models.DBSession.close() time_delta = time.time() - start_time if time_delta > 0: time.sleep(30 - time_delta)
def main(): with environment(sys.argv) as env: print env
def main(): with environment(sys.argv) as env: for currency_pair in DBSession.query(CurrencyPair): print currency_pair.source, currency_pair.target with open("%s-%s.txt" % (currency_pair.source, currency_pair.target), "w") as outfile: currency_pair_stats(outfile, currency_pair)