mercredi 26 juin 2019

How to check and extract the url containing the random number with the status code

import string
import random
import requests

_LENGTH = 5 
string_pool = string.digits
result = ""
for i in range(_LENGTH):
    result += random.choice(string_pool) 

url = "http://bbs.blabla.com/" + result
response = requests.get(url)

if response.status_code = 200:
    print(url)

Based on the following function, How do I code to identify and extract accessible URLs with status codes? I want to know both how to extract all URLs and how to extract first URL. I would really appreciate it if you let me know the code including multiprocessing.




Aucun commentaire:

Enregistrer un commentaire