Royalphax / credit-agricole-importer

Auto import your Credit Agricole transactions into FireflyIII personal finance manager
MIT License
8 stars 6 forks source link

fix for usage of department instead of region #10

Closed coolcow closed 1 year ago

coolcow commented 1 year ago

i fixed this incompatibilty => https://github.com/Royalphax/credit-agricole-importer/issues/3

instead of configuring for bank-region you now have to configure for bank-department which is a number. Example:

[CreditAgricole]
bank-region = paris # old
bank-department = 75 # new
...

I included a mapping for department to the corresponding region:

DEPARTMENTS_TO_REGIONS = {
    '01': 'sudrhonealpes',
    '02': 'briepicardie',
    '05': 'alpesprovence',
    '06': 'alpesprovence',
    '07': 'sudrhonealpes',
    '08': 'nord-est',
    '09': 'pyrenees-gascogne',
    '10': 'nord-est',
    '11': 'languedoc',
    '13': 'alpesprovence',
    '14': 'normandie',
    '15': 'cmds',
    '16': 'charente-perigord',
    '17': 'centreouest',
    '18': 'centreloire',
    '21': 'centrefrance',
    '22': 'cotesdarmor',
    '24': 'aquitaine',
    '25': 'franchecomte',
    '26': 'sudrhonealpes',
    '27': 'normandie',
    '28': 'centrest',
    '29': 'finistere',
    '30': 'languedoc',
    '31': 'pyrenees-gascogne',
    '32': 'pyrenees-gascogne',
    '33': 'aquitaine',
    '34': 'sudmed',
    '35': 'illeetvilaine',
    '36': 'centrest',
    '37': 'centrest',
    '37': 'tourainepoitou',
    '38': 'sudrhonealpes',
    '39': 'franchecomte',
    '40': 'aquitaine',
    '40': 'pyrenees-gascogne',
    '41': 'centrest',
    '41': 'tourainepoitou',
    '42': 'loirehauteloire',
    '42': 'sudrhonealpes',
    '43': 'cmds',
    '43': 'loirehauteloire',
    '44': 'atlantique-vendee',
    '45': 'centrest',
    '47': 'aquitaine',
    '48': 'languedoc',
    '48': 'sudmed',
    '49': 'anjou-maine',
    '50': 'normandie',
    '51': 'nord-est',
    '52': 'nord-est',
    '53': 'anjou-maine',
    '54': 'lorraine',
    '55': 'lorraine',
    '55': 'nord-est',
    '56': 'morbihan',
    '57': 'lorraine',
    '57': 'nord-est',
    '58': 'centrefrance',
    '59': 'norddefrance',
    '60': 'briepicardie',
    '61': 'normandie',
    '62': 'norddefrance',
    '63': 'loirehauteloire',
    '64': 'pyrenees-gascogne',
    '66': 'languedoc',
    '66': 'sudmed',
    '67': 'alsace-vosges',
    '67': 'nord-est',
    '68': 'alsace-vosges',
    '68': 'nord-est',
    '69': 'loirehauteloire',
    '69': 'sudrhonealpes',
    '70': 'franchecomte',
    '71': 'centrefrance',
    '72': 'anjou-maine',
    '73': 'des-savoie',
    '73': 'sudrhonealpes',
    '74': 'des-savoie',
    '74': 'sudrhonealpes',
    '75': 'paris',
    '76': 'normandie',
    '76': 'normandie-seine',
    '77': 'valdefrance',
    '79': 'centreouest',
    '80': 'briepicardie',
    '83': 'pca',
    '84': 'pca',
    '85': 'atlantique-vendee',
    '86': 'centreouest',
    '86': 'tourainepoitou',
    '88': 'lorraine',
    '88': 'nord-est',
    '971': 'guadeloupe',
    '972': 'martinique',
    '974': 'reunion',
    '9A': 'cb',
    '9B': 'cb'
}   

I also had to fix the openstreetmap url from: url = 'https://nominatim.openstreetmap.org/search/' + urllib.parse.quote(address) +'?format=json' to url = 'https://nominatim.openstreetmap.org/search.php?q=' + urllib.parse.quote(address) +'&format=jsonv2'

Royalphax commented 1 year ago

Thanks a lot @coolcow for your contribution!