Web pages prevent xss attacks

from bs4 import BeautifulSoup

 

soup = BeautifulSoup (content, 'html.parser') # content upload content for the obtained user

tags = soup.find_all()

for tag in tags:

  if tag.name == 'script':

    tag.decompose()

content = str(soup)

 

Guess you like

Origin www.cnblogs.com/JackShi/p/12722237.html