Page search program for a Python website

Asked

Viewed 121 times

0

I want to write a code in Python that accesses a 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 but 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

1 answer

2

There is an error in your code. Missing is the location where the variable value will be injected line at the url.

response = requests.get('https://www.nomedosite.com/{}'.format(linha))
  • Damn truth kkk more still not working

Browser other questions tagged

You are not signed in. Login or sign up in order to post.