Skip to content

Instantly share code, notes, and snippets.

@rejsmont
Created September 11, 2020 15:19
Check if the results for ANR grant committee are available
import re, requests
from urllib.request import urlopen
from lxml import etree
def committee_available(comm):
url = 'https://anr.fr/fr/detail/call/appel-a-projets-generique-2020/'
headers = {'Content-Type': 'text/html',}
response = requests.get(url, headers=headers)
html = response.text
htmlparser = etree.HTMLParser()
tree = etree.fromstring(html, htmlparser)
r = tree.xpath('//section/div/div/ul/li/a[contains(@href,"selection") and contains(text(),"JCJC")]')
r[0].xpath('@href')
txt = r[0].xpath('text()')[0]
resul = re.search('.*?(([0-9]{1,2}-)*[0-9]{1,2}).*', txt)
coms = resul.group(1).split('-')
return comm in coms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment