Changeset - 8b0fd526023c
[Not reviewed]
0 2 0
Rosanne DiMesio - 3 years ago 2021-10-25 16:29:41
dimesio@earthlink.net
update GitHub Sponsors importer
2 files changed with 7 insertions and 8 deletions:
0 comments (0 inline, 0 general)
import2ledger/importers/github.py
Show inline comments
...
 
@@ -6,15 +6,14 @@ from .. import strparse
 
class SponsorsImporter(_csv.CSVImporterBase):
 
    DATE_FMT = '%Y-%m-%d %H:%M:%S %z'
 
    NEEDED_FIELDS = frozenset([
 
        'processed amount',
 
        'status',
 
        'transaction date',
 
        'transferred amount',
 
        'transaction timestamp',
 
    ])
 
    COPIED_FIELDS = {
 
        'sponsor handle': 'handle',
 
        # 'sponsor profile name': 'name',
 
        'sponsor email': 'email',
 
        'transaction id': 'transaction_id',
 
        'stripe transfer id': 'transaction_id',
 
    }
 
    ENTRY_SEED = {'currency': 'USD'}
 
    PAYEE_MAP = {
...
 
@@ -22,12 +21,12 @@ class SponsorsImporter(_csv.CSVImporterBase):
 
    }
 

	
 
    def _read_row(self, row):
 
        amount = strparse.currency_decimal(row['processed amount'])
 
        if (not amount) or row['status'] != 'settled':
 
        amount = strparse.currency_decimal(row['transferred amount'])
 
        if (not amount):
 
            return None
 
        payee = row.get('sponsor profile name') or row['sponsor handle']
 
        return {
 
            'amount': amount,
 
            'date': strparse.date(row['transaction date'], self.DATE_FMT),
 
            'date': strparse.date(row['transaction timestamp'], self.DATE_FMT),
 
            'payee': self.PAYEE_MAP.get(payee, payee),
 
        }
setup.py
Show inline comments
...
 
@@ -30,7 +30,7 @@ REQUIREMENTS['tests_require'] = [
 
setup(
 
    name='import2ledger',
 
    description="Import different sources of financial data to Ledger",
 
    version='1.4.4',
 
    version='1.4.5',
 
    author='Brett Smith',
 
    author_email='brettcsmith@brettcsmith.org',
 
    license='GNU AGPLv3+',
0 comments (0 inline, 0 general)