pax_global_header 0000666 0000000 0000000 00000000064 14575653726 0014536 g ustar 00root root 0000000 0000000 52 comment=5f3d558793b537a74480241ac6981479f5938cd3
woob-master-5f3d558793b537a74480241ac6981479f5938cd3-modules-infomaniak/ 0000775 0000000 0000000 00000000000 14575653726 0024156 5 ustar 00root root 0000000 0000000 woob-master-5f3d558793b537a74480241ac6981479f5938cd3-modules-infomaniak/modules/ 0000775 0000000 0000000 00000000000 14575653726 0025626 5 ustar 00root root 0000000 0000000 woob-master-5f3d558793b537a74480241ac6981479f5938cd3-modules-infomaniak/modules/infomaniak/ 0000775 0000000 0000000 00000000000 14575653726 0027742 5 ustar 00root root 0000000 0000000 __init__.py 0000664 0000000 0000000 00000001534 14575653726 0031777 0 ustar 00root root 0000000 0000000 woob-master-5f3d558793b537a74480241ac6981479f5938cd3-modules-infomaniak/modules/infomaniak # -*- coding: utf-8 -*-
# Copyright(C) 2017 Vincent A
# flake8: compatible
# This file is part of a woob module.
#
# This woob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This woob module is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this woob module. If not, see .
from .module import InfomaniakModule
__all__ = ['InfomaniakModule']
browser.py 0000664 0000000 0000000 00000006106 14575653726 0031723 0 ustar 00root root 0000000 0000000 woob-master-5f3d558793b537a74480241ac6981479f5938cd3-modules-infomaniak/modules/infomaniak # -*- coding: utf-8 -*-
# Copyright(C) 2017 Vincent A
# flake8: compatible
# This file is part of a woob module.
#
# This woob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This woob module is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this woob module. If not, see .
from woob.browser import LoginBrowser, URL, need_login
from woob.browser.exceptions import ServerError
from woob.exceptions import BrowserIncorrectPassword, BrowserQuestion
from woob.tools.value import Value
from .pages import LoginPage, SubscriptionsPage, DocumentsPage
class InfomaniakBrowser(LoginBrowser):
BASEURL = 'https://manager.infomaniak.com'
login = URL(r'https://login.infomaniak.com/api/login', LoginPage)
profile = URL(r'/v3/api/proxypass/profile', SubscriptionsPage)
documents = URL(r'/v3/api/invoicing/(?P.*)/invoices', DocumentsPage)
def __init__(self, config, *args, **kwargs):
self.config = config
kwargs['username'] = self.config['login'].get()
kwargs['password'] = self.config['password'].get()
super(InfomaniakBrowser, self).__init__(*args, **kwargs)
def do_login(self):
try:
if self.config['otp'].get():
self.login.go(
data={
'login': self.username,
'password': self.password,
'double_auth_code': self.config['otp'].get(),
}
)
else:
self.login.go(data={'login': self.username, 'password': self.password})
except ServerError as e:
if e.response.status_code == 500:
page = LoginPage(self, e.response)
# first for the wrongpass, second for the otp failed
error_msgs = ["Invalid login or password", "The authentication code is incorrect"]
if page.get_error() in error_msgs:
raise BrowserIncorrectPassword(page.get_error())
raise
if self.page.has_otp and not self.config['otp'].get():
raise BrowserQuestion(Value('otp', label='Enter the OTP'))
@need_login
def iter_subscription(self):
self.profile.go()
return [self.page.get_subscription()]
@need_login
def iter_documents(self, subscription):
params = {
'ajax': 'true',
'order_by': 'name',
'order_for[name]': 'asc',
'page': '1',
'per_page': '100',
}
self.documents.go(subid=subscription.id, params=params)
return self.page.iter_documents(subid=subscription.id)
favicon.png 0000664 0000000 0000000 00000001320 14575653726 0032012 0 ustar 00root root 0000000 0000000 woob-master-5f3d558793b537a74480241ac6981479f5938cd3-modules-infomaniak/modules/infomaniak PNG
IHDR L\ pHYs tIME
0m iTXtComment Created with GIMPd.e FIDATxn1DV~P)K.cϙG@̉ل=) @ ~ Z-0Lp `0]Oa*{ݙ X @ }y" @}xqN)J)1pp_y|y8xB;L:>__;Fj /A֫GɶA0#\N2}KՂ[WHF^sSԎX.1G@:s@1;
CPxy8 wUvM ; Q ^gĪfX9A{$Z Cf