pax_global_header 0000666 0000000 0000000 00000000064 13514067645 0014525 g ustar 00root root 0000000 0000000 52 comment=6d52c0c92f2617476fe0b131c1eebba68676b2fb
woob-6d52c0c92f2617476fe0b131c1eebba68676b2fb-modules-ldlc/ 0000775 0000000 0000000 00000000000 13514067645 0022131 5 ustar 00root root 0000000 0000000 woob-6d52c0c92f2617476fe0b131c1eebba68676b2fb-modules-ldlc/modules/ 0000775 0000000 0000000 00000000000 13514067645 0023601 5 ustar 00root root 0000000 0000000 woob-6d52c0c92f2617476fe0b131c1eebba68676b2fb-modules-ldlc/modules/ldlc/ 0000775 0000000 0000000 00000000000 13514067645 0024517 5 ustar 00root root 0000000 0000000 woob-6d52c0c92f2617476fe0b131c1eebba68676b2fb-modules-ldlc/modules/ldlc/__init__.py 0000664 0000000 0000000 00000001511 13514067645 0026626 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# Copyright(C) 2015 Vincent Paredes
#
# This file is part of a weboob module.
#
# This weboob 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 weboob 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 weboob module. If not, see .
from .module import LdlcModule
__all__ = ['LdlcModule']
woob-6d52c0c92f2617476fe0b131c1eebba68676b2fb-modules-ldlc/modules/ldlc/browser.py 0000664 0000000 0000000 00000010644 13514067645 0026561 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# Copyright(C) 2015 Vincent Paredes
#
# This file is part of a weboob module.
#
# This weboob 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 weboob 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 weboob module. If not, see .
from weboob.browser import LoginBrowser, AbstractBrowser, URL, need_login
from weboob.exceptions import BrowserIncorrectPassword
from .pages import HomePage, LoginPage, ProBillsPage, DocumentsPage
class LdlcParBrowser(AbstractBrowser):
PARENT = 'materielnet'
BASEURL = 'https://secure2.ldlc.com'
documents = URL(r'/fr-fr/Orders/PartialCompletedOrdersHeader', DocumentsPage)
def __init__(self, *args, **kwargs):
super(LdlcParBrowser, self).__init__(*args, **kwargs)
self.lang = 'fr-fr/'
@need_login
def iter_documents(self, subscription):
json_response = self.location('/fr-fr/Orders/CompletedOrdersPeriodSelection').json()
for data in json_response:
for doc in self.location('/fr-fr/Orders/PartialCompletedOrdersHeader', data=data).page.get_documents(subid=subscription.id):
yield doc
class LdlcBrowser(LoginBrowser):
login = URL(r'/Account/LoginPage.aspx', LoginPage)
home = URL(r'/$', HomePage)
def do_login(self):
self.login.stay_or_go()
website = 'part' if type(self) == LdlcParBrowser else 'pro'
self.page.login(self.username, self.password, website)
if self.login.is_here():
raise BrowserIncorrectPassword(self.page.get_error())
@need_login
def get_subscription_list(self):
return self.home.stay_or_go().get_subscriptions()
class LdlcProBrowser(LdlcBrowser):
BASEURL = 'https://secure.ldlc-pro.com'
bills = URL(r'/Account/CommandListingPage.aspx', ProBillsPage)
@need_login
def iter_documents(self, subscription):
self.bills.stay_or_go()
for value in self.page.get_range():
self.bills.go(data={'ctl00$cphMainContent$ddlDate': value, '__EVENTTARGET': 'ctl00$cphMainContent$ddlDate'})
view_state = self.page.get_view_state()
# we need position to download file
position = 1
hidden_field = self.page.get_ctl00_actScriptManager_HiddenField()
for bill in self.page.iter_documents(subid=subscription.id):
bill._position = position
bill._view_state = view_state
bill._hidden_field = hidden_field
position += 1
yield bill
@need_login
def download_document(self, bill):
data = {
'__EVENTARGUMENT': '',
'__EVENTTARGET': '',
'__LASTFOCUS': '',
'__SCROLLPOSITIONX': 0,
'__SCROLLPOSITIONY': 0,
'__VIEWSTATE': bill._view_state,
'ctl00$actScriptManager': '',
'ctl00$cphMainContent$DetailCommand$hfCommand': '',
'ctl00$cphMainContent$DetailCommand$txtAltEmail': '',
'ctl00$cphMainContent$ddlDate': bill.date.year,
'ctl00$cphMainContent$hfCancelCommandId': '',
'ctl00$cphMainContent$hfCommandId': '',
'ctl00$cphMainContent$hfCommandSearch': '',
'ctl00$cphMainContent$hfOrderTri': 1,
'ctl00$cphMainContent$hfTypeTri': 1,
'ctl00$cphMainContent$rptCommand$ctl%s$hlFacture.x' % str(bill._position).zfill(2): '7',
'ctl00$cphMainContent$rptCommand$ctl%s$hlFacture.y' % str(bill._position).zfill(2): '11',
'ctl00$cphMainContent$txtCommandSearch': '',
'ctl00$hfCountries': '',
'ctl00$ucHeaderControl$ctrlSuggestedProductPopUp$HiddenCommandeSupplementaire': '',
'ctl00$ucHeaderControl$ctrlSuggestedProductPopUp$hiddenPopUp': '',
'ctl00$ucHeaderControl$txtSearch': 'Rechercher+...',
'ctl00_actScriptManager_HiddenField': bill._hidden_field
}
return self.open(bill.url, data=data).content
woob-6d52c0c92f2617476fe0b131c1eebba68676b2fb-modules-ldlc/modules/ldlc/favicon.png 0000664 0000000 0000000 00000001535 13514067645 0026656 0 ustar 00root root 0000000 0000000 PNG
IHDR @ @ pHYs tIME;-> PLTE {|}~TUWXXYZKLLMNN?AB ? @ @
ADEEEE*Y*Z+Z+[1_2`2`EoFoLtMtMuMuTzڻMw bKGDPnL IDATXm[0Zh;]amDv2o_pk