Skip to content

Commit 7bea0e1

Browse files
committed
optimize fast-path
1 parent 9defdc2 commit 7bea0e1

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

locust_testplan.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from bs4 import BeautifulSoup
33
import random
44
import string
5+
import re
56

67
def random_word():
78
"""Return 1 to 12 random characters, a-z inclusive."""
@@ -32,10 +33,7 @@ def fetch_static_assets(session, response):
3233
downloaded."""
3334
resource_urls = set()
3435

35-
soup = BeautifulSoup(response.text, "html.parser")
36-
37-
for res in soup.find_all(src=True):
38-
url = res['src']
36+
for url in re.findall(r'''src=['"](.*?)['"]''', response.text, re.I):
3937
if is_static_file(url):
4038
resource_urls.add(url)
4139

0 commit comments

Comments
 (0)