コード例 #1
0
 def handle_resources(content_type, content):
     urls_from_css, urls_from_svg = [], []
     if content_type.startswith("text/css"):
         urls_from_css = parsers.get_urls_from_css_resource(content)
     if content_type.startswith("image/svg"):
         urls_from_svg = parsers.get_urls_from_svg_resource(content)
     for discovered_url in urls_from_css + urls_from_svg:
         target_url = _apply_base_url(discovered_url, base_url)
         with self.discovered_resources_lock:
             discovered_resources_urls.append(target_url)
コード例 #2
0
ファイル: render_task.py プロジェクト: brent-brown/CFAHome
 def handle_resources(content_type, content, resource_url):
     logger.debug("handle_resources({0}, {1}) call".format(
         content_type, resource_url))
     urls_from_css, urls_from_svg = [], []
     if content_type.startswith("text/css"):
         urls_from_css = parsers.get_urls_from_css_resource(content)
     if content_type.startswith("image/svg"):
         urls_from_svg = parsers.get_urls_from_svg_resource(content)
     for discovered_url in urls_from_css + urls_from_svg:
         if discovered_url.startswith(
                 "data:") or discovered_url.startswith("#"):
             # resource already in blob or not relevant
             continue
         target_url = apply_base_url(discovered_url, base_url,
                                     resource_url)
         with discovered_resources_lock:
             discovered_resources_urls.add(target_url)
コード例 #3
0
def test_parse_invalid_svg_with_comment_on_top():
    content = get_resource("fa-regular-400.svg")
    parsers.get_urls_from_svg_resource(content)
コード例 #4
0
def test_parse_valid_svg_with_bom():
    content = get_resource("ios.svg")
    parsers.get_urls_from_svg_resource(content)
コード例 #5
0
def test_parse_valid_svg_with_links():
    content = get_resource("applitools_logo_combined.svg")
    urls = parsers.get_urls_from_svg_resource(content)
    assert urls == ["slogan.svg", "logo.svg", "company_name.png"]
コード例 #6
0
def test_parse_valid_svg():
    content = get_resource("chevron.svg")
    parsers.get_urls_from_svg_resource(content)