Merge branch 'master' of https://moriya.zapto.org/LCI/defi-rendu-legifrance
This commit is contained in:
commit
4611a66276
12
fetch.py
12
fetch.py
@ -10,10 +10,12 @@ def runfetch(url):
|
||||
session=requests.Session()
|
||||
req1=session.get(url)
|
||||
text=req1.text.split('\n')
|
||||
text='\n'.join(text[text.index('<br/>ANNEXES<br/>ANNEXE I</p>'):text.index('<div style="margin-top: 30px; margin-bottom:20px;" id="JORFSCTA000037493059" class="titreSection">Annexe </div>'):]).split('<tr>')[2::]
|
||||
text=['\n'.join(row.split('\n')[:row.split('\n').index("</tr>"):]) for row in '\n'.join(text[text.index('<br/>ANNEXES<br/>ANNEXE I</p>'):text.index('<div style="margin-top: 30px; margin-bottom:20px;" id="JORFSCTA000037493059" class="titreSection">Annexe </div>'):]).split('<tr>')[2::]]
|
||||
diclist=[]
|
||||
for row in text:
|
||||
pass
|
||||
|
||||
cols=[text.split('\n')[2][5::] if len(text.split('\n'))==3 else "" for text in row.split("</td")[::]]
|
||||
diclist.append({"id":cols[0],"commune":cols[1],"site":cols[2],"departement":cols[3],"zone":cols[4],"ministere":cols[5],"aerozone":cols[6]})
|
||||
return diclist
|
||||
if __name__ == '__main__':
|
||||
runfetch('https://www.legifrance.gouv.fr/eli/arrete/2018/10/12/PRMD1824595A/jo/texte')
|
||||
|
||||
diclist=runfetch('https://www.legifrance.gouv.fr/eli/arrete/2018/10/12/PRMD1824595A/jo/texte')
|
||||
url='https://www.legifrance.gouv.fr/eli/arrete/2018/10/12/PRMD1824595A/jo/texte'
|
||||
|
Loading…
Reference in New Issue
Block a user