- # ali engin musaoglu - ALI ENGIN MUSAOGLU
- import httplib, urllib, re
- ss = 0
- isim = raw_input("isim : ")
- soyisim = raw_input("soyisim : ")
- parametre = urllib.urlencode({'sorgu': 'ddl'})
- sehir = ['322-Adana', '416-Ad%FDyaman', '272-Afyon', '472-A%F0r%FD', '382-Aksaray', '358-Amasya', '312-Ankara', '242-Antalya', '478-Ardahan', '466-Artvin', '$
- #sehir = ['322-Adana', '312-Ankara', '242-Antalya', '224-Bursa', '222-Eski%FEehir', '212-%DDstanbul(Avr.)', '216-%DDstanbul(Asy.)', '232-%DDzmir', '422-Malat$
- baslik = {'Content-type': 'application/x-www-form-urlencoded', 'Accept': 'text:plain'}
- sunucu = 'www.ttrehber.gov.tr'
- parametre = urllib.urlencode({'sunucu': 'ddl'})
- cnn = httplib.HTTPConnection(sunucu)
- txtkayit=open(isim+' '+soyisim+'.txt','w')
- for i in range(len(sehir)):
- sayfa = '/trk-wp/IDA2?IDAERROR=&QRY=all&RNG=lequ&CTRY=trk&LANG=tu&PAGE=simpleSearch&LIP=simpleSearch&ACTION=search&STP=S&REQ=20&NAM=' + soyisim + '&STN='$
- cnn.request('POST', sayfa, parametre, baslik)
- cevap = cnn.getresponse()
- str = cevap.read()
- sablon= re.compile('(bone bulunamad|t fazla kay|orgulama S)', re.IGNORECASE)
- uyanlar= sablon.search(str)
- if uyanlar.group(1) == 'bone bulunamad':
- print sehir[i], 'Abone Bulunamadi'
- elif uyanlar.group(1) == 't fazla kay':
- ss=ss+1
- print sehir[i], 'Fazla Kayit'
- txtkayit.write (isim + ' ' + soyisim + ' ' + sehir[i] + ' ilinde ' + ' FAZLA KAYIT VAR ! \n')
- elif uyanlar.group(1) == 'orgulama S':
- print sehir[i], '- - - - - SONUC VAR - - - - -'
- txtkayit.write (isim + ' ' + soyisim + ' ' + sehir[i] + ' ilinde ' + ' VAR ! \n')
- ss=ss+1
- txtkayit.write (ss + ' sehirde ')
- cnn.close
- print ss, ' sehirde '+ isim + ' '+ soyisim + ' var'
Posted by ali engin musaoglu on Tue 29 Jan 00:17 (modification of post by view diff)
report abuse | View followups from ibrahim yilmaz, Anonymous, zden yaman, d, mehmet ceylan, ERSEN GNL, AYFER SARA, mehmet, oktay yurtalan, Anonymous, hseyin demircan, blent ler, asl bozer and akn kutluer | download | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.