import urllib

#URL='http://soroban-exam.appspot.com/generator'
URL='http://localhost:8080/generator'
POST = {'level':5, 'model':'CUMIN', 'locale':'AUTO', 'rlocale':'fr_fr', 'format':'PDF', 'size':'A4', 'solution':'END'}

for i in range(500):
    f = urllib.urlopen(URL, urllib.urlencode(POST))
    pdf = open('test%03d.pdf' % i, 'w')
    pdf.write(f.read())
    f.close()
    pdf.close()
