import re import requests def getpage(leg, words): url = "https://www2.assemblee-nationale.fr/recherche/resultats_questions" token = "eyJxIjoibGVnaXNsYXR1cmU6MTUgYW5kIHNzVHlwZURvY3VtZW50OihxZSBPUiBxZyBPUiBxb3NkKSBhbmQgY29udGVudToocGVzdGljaWRlcykiLCJyb3dzIjoiMjUiLCJzb3J0Ijoic3NUeXBlRG9jdW1lbnQgYXNjLCBudW1Eb2N1bWVudCBkZXNjIn0=" formData = ( ('legislature', leg), ('q', words), ('q_in', 0), ("limit", 25), ) with requests.Session() as s: url2 = f'{url}/{token}' s.get(url2) formule_data = {'legislature': leg, 'q': words, 'q_in': 0, 'limit': 25} r = s.post(url2, data = formule_data) return r.text leg = "15" words = "glyphosate" html = getpage(leg, words) print(html) #print("found %d questions" % len(dicQ), html)