Skip to content

Instantly share code, notes, and snippets.

@rejsmont
Created September 11, 2020 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rejsmont/d6980ff8d111d7d2211eaca28fac04d8 to your computer and use it in GitHub Desktop.
Save rejsmont/d6980ff8d111d7d2211eaca28fac04d8 to your computer and use it in GitHub Desktop.
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