Python website page search engine

0

I want to write a Python code that accesses a particular site by placing a list of words at the end of the URL to find the pages of the site with a timer. I did however it does not return me the name of the pages. Here is the code:

import requests
import time

list = open('lista.txt')
lista = list.read()
list.close

for linha in lista.split('\n'):
     response = requests.get('https://www.nomedosite.com'.format(linha))
     time.sleep(3)

     if response.status_code == '200' :

       print response
    
asked by anonymous 11.10.2018 / 02:01

1 answer

2

There is an error in your code. It is necessary to indicate where the line variable in the url will be injected.

response = requests.get('https://www.nomedosite.com/{}'.format(linha))
    
11.10.2018 / 02:49