From 032f313072133647d7799f69be3f21c44b2d2190 Mon Sep 17 00:00:00 2001 From: Edouard Lambert Date: Fri, 6 Mar 2020 10:28:20 +0100 Subject: [PATCH] [swile] rename lunchr to swile --- modules/{lunchr => swile}/__init__.py | 4 ++-- modules/{lunchr => swile}/browser.py | 16 ++++++++-------- modules/{lunchr => swile}/module.py | 12 ++++++------ 3 files changed, 16 insertions(+), 16 deletions(-) rename modules/{lunchr => swile}/__init__.py (92%) rename modules/{lunchr => swile}/browser.py (92%) rename modules/{lunchr => swile}/module.py (89%) diff --git a/modules/lunchr/__init__.py b/modules/swile/__init__.py similarity index 92% rename from modules/lunchr/__init__.py rename to modules/swile/__init__.py index 8763034765..bf2a8107e2 100644 --- a/modules/lunchr/__init__.py +++ b/modules/swile/__init__.py @@ -20,7 +20,7 @@ from __future__ import unicode_literals -from .module import LunchrModule +from .module import SwileModule -__all__ = ['LunchrModule'] +__all__ = ['SwileModule'] diff --git a/modules/lunchr/browser.py b/modules/swile/browser.py similarity index 92% rename from modules/lunchr/browser.py rename to modules/swile/browser.py index b2233f7eb0..9034b275fd 100644 --- a/modules/lunchr/browser.py +++ b/modules/swile/browser.py @@ -34,13 +34,13 @@ from weboob.capabilities.bank import Account, Transaction -class LunchrBrowser(APIBrowser): - BASEURL = 'https://api.lunchr.fr' +class SwileBrowser(APIBrowser): + BASEURL = 'https://customer-api.swile.co' def __init__(self, login, password, *args, **kwargs): - """LunchrBrowser needs login and password to fetch Lunchr API""" - super(LunchrBrowser, self).__init__(*args, **kwargs) - # self.session.headers are the HTTP headers for Lunchr API requests + """SwileBrowser needs login and password to fetch Swile API""" + super(SwileBrowser, self).__init__(*args, **kwargs) + # self.session.headers are the HTTP headers for Swile API requests self.session.headers['x-api-key'] = '644a4ef497286a229aaf8205c2dc12a9086310a8' self.session.headers['x-lunchr-app-version'] = 'b6c6ca66c79ca059222779fe8f1ac98c8485b9f0' self.session.headers['x-lunchr-platform'] = 'web' @@ -53,7 +53,7 @@ def __init__(self, login, password, *args, **kwargs): } def _auth(self): - """Authenticate to Lunchr API using self.credentials. + """Authenticate to Swile API using self.credentials. If authentication succeeds, authorization header is set in self.headers and response's json payload is returned unwrapped into dictionary. """ @@ -74,7 +74,7 @@ def get_account(self): account = Account(id=Dict('id')(json)) account.number = account.id # weboob.capabilities.bank.BaseAccount - account.bank_name = 'Lunchr' + account.bank_name = 'Swile' account.type = Account.TYPE_CHECKING @@ -139,7 +139,7 @@ def _parse_transaction(self, payment): transaction.rdate = DateTime(Dict('created_at'))(payment) types = { - 'ORDER': Transaction.TYPE_CARD, # order on lunchr website + 'ORDER': Transaction.TYPE_CARD, # order on swile website 'LUNCHR_CARD_PAYMENT': Transaction.TYPE_CARD, # pay in shop 'MEAL_VOUCHER_CREDIT': Transaction.TYPE_DEPOSIT, # type can be null for refunds diff --git a/modules/lunchr/module.py b/modules/swile/module.py similarity index 89% rename from modules/lunchr/module.py rename to modules/swile/module.py index a836f476b0..cbb6ad9e4a 100644 --- a/modules/lunchr/module.py +++ b/modules/swile/module.py @@ -23,20 +23,20 @@ from weboob.tools.value import ValueBackendPassword from weboob.capabilities.bank import CapBank -from .browser import LunchrBrowser +from .browser import SwileBrowser -__all__ = ['LunchrModule'] +__all__ = ['SwileModule'] -class LunchrModule(Module, CapBank): - NAME = 'lunchr' - DESCRIPTION = 'Lunchr' +class SwileModule(Module, CapBank): + NAME = 'swile' + DESCRIPTION = 'Swile' MAINTAINER = 'Roger Philibert' EMAIL = 'roger.philibert@gmail.com' LICENSE = 'LGPLv3+' VERSION = '2.1' - BROWSER = LunchrBrowser + BROWSER = SwileBrowser CONFIG = BackendConfig( ValueBackendPassword('login', label='E-mail', masked=False), -- GitLab