Пример #1
0
def import_transactions():
    """ 
    Interactively attach tags to the vendors present in an aggregator account. 
    """
    import getpass
    import pprint
    from scraper import get_transactions
    aggregator = raw_input("Aggregator (mint/wesabe): ")
    agg_username = raw_input("Username: "******"Password: "******"(", i, len(results), ")"
        print result['channel']
        if result['channel'] not in ['atm', 'pos', 'deposit', 'dividend', 'fee', 'rev fee']:
            continue

        pprint.pprint(result['vendor'])
        tagit = raw_input("Tag this? (y/n): ")
        if tagit == "y":
            tagstr = raw_input("Tags (k1=v1|k2=v2|): ")
            tags = dict(tag.split("=") for tag in tagstr.split("|"))
            kwargs = {
                'username': grocktx_username,
                'password': grocktx_password,
                'vendor': result['vendor'],
                'tags': [{"key": k, "value": v} for k,v in tags.iteritems()],
            }
            result = put_params(kwargs)
            print result
Пример #2
0
 def test_scraper(self):
     """ 
     It is very difficult to test that transactions were correctly obtained
     in a generic way.  Thus we just run the scraper and display the results
     -- any errors that prevent it from running are caught, and errors in
     functionality can be inspected visually.
     """
     for provider, creds in self.credentials.iteritems():
         print "########################### %s #######################" % provider
         results = scraper.get_transactions(provider, creds['username'], creds['password'])
         chan_counts = {}
         for result in results:
             chan_counts[result['channel']] = chan_counts.get(result['channel'], 0) + 1
             if result['channel'] == 'unknown':
                 print "##! UNKOWN CHANNEL"
                 pprint.pprint(result)
         print "Results by channel: "
         pprint.pprint(chan_counts)