Guest User

Untitled

a guest
Feb 10th, 2020
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.60 KB | None | 0 0
  1. import requests
  2. input_file=input('filename input file with txt: ')
  3. output_file=input('output filename with txt: ')
  4.  
  5. good=[]
  6. s=requests.Session()
  7. headers={
  8. 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; rv:61.0) Gecko/20100101 Firefox/61.0',
  9. 'Accept': '*/*',
  10. 'Accept-Language':'ru-RU,ru;q=0.8,en-US'
  11. }
  12. #
  13.  
  14. with open(input_file, 'r') as f:
  15.     for i in f:
  16.         i=i.replace('\n', '')
  17.         try:
  18.             r=s.get('https://duckduckgo.com', headers=headers, proxies={'http://'+i, 'https://'+i})
  19.             good.append(i)
  20.             print(r)
  21.         except:
  22.             print(i+' bad')
  23.        
  24. with open(output_file,  'a') as f:
  25.     for i in good:
  26.         f.write(i)
Advertisement
Add Comment
Please, Sign In to add comment