小编Cyn*_*nic的帖子

无论如何使用JSON-LD Schema没有内联

无论如何使用JSON-LD而不script在HTML中包含内联,但仍然可以让Google(和其他)蜘蛛找到它吗?环顾四周,我看到了一些相互矛盾的信息.

如果这是JSON-LD文件:

    <script type="application/ld+json">
    {
      "@context" : "http://schema.org",
      "@type" : "WebSite",
      "name" : "Example Site",
      "alternateName" : "example",
      "description" : "Welcome to this WebSite",
      "headline" : "Welcome to Website",
      "logo" : "https://example.com/public/images/logo.png",
      "url" : "https://example.com/"
    }
    </script>
Run Code Online (Sandbox Code Playgroud)

head在HTML中有这个:

<script src="/public/json-ld.json" type="application/ld+json"></script>
Run Code Online (Sandbox Code Playgroud)

编辑:我也尝试过:

<link href="/public/json-ld.json" rel="alternate" type="application/ld+" />
Run Code Online (Sandbox Code Playgroud)

谷歌蜘蛛似乎很想念它,测试工具也是如此,除非我直接指向该文件.我正在努力解决CSP中的不安全内联问题.我唯一能找到的就是这个,它可以在Chrome中运行,但不希望在每个其他浏览器上触发控制台错误.另外,我只是喜欢从页面结构中抽象出Schema.org数据的想法.将JSON-LD添加到Google网站站长工具的站点地图会有帮助吗?

道歉,JSON-lD的总菜单,并最终保留在电子邮件文档(这将是一个站点)或旧文档.

seo schema.org content-security-policy json-ld

8
推荐指数
1
解决办法
988
查看次数

burp 套件和wireshark 有什么区别?利弊

我看到很多人都在谈论这两个工具Burp 套件和 Wireshark最适合渗透测试,但我很好奇它们各自的优缺点是什么?他们每个人在哪里会更好地使用有什么区别?

security networking wireshark burp websecurity

8
推荐指数
1
解决办法
6258
查看次数

定义适用于多个关键字的行为步骤(例如 Given、When 和 Then)

有没有办法编写适用于多个关键字的步骤。就像说我的特点是:

Scenario: Something happens after navigating 
  Given I navigate to "/"
    And say some cookie gets set
  When I navigate to "/some-other-page"
  Then something happens because of that cookie
Run Code Online (Sandbox Code Playgroud)

我试图避免同时定义:

    @given('I navigate to "{uri}"')
    def get(context, uri):
        current_url = BASE_URL + uri
        context.driver.get(current_url)

    @when('I navigate to "{uri}"')
    def get(context, uri):
        current_url = BASE_URL + uri
        context.driver.get(current_url)
Run Code Online (Sandbox Code Playgroud)

如果您只定义一个并尝试将其用作两者,则会出现raise NotImplementedError(u'STEP:错误。在上面的例子中,它并没有那么糟糕,因为这一步很简单,但重复代码似乎是一种不好的做法,而且你可能会在更复杂的事情上发生同样的事情,对我来说,如果有像一个@all 或 @any 关键字。

抱歉,如果这已在某处得到解答,但很难搜索,因为很难找到此类问题的独特搜索词

python bdd python-3.x python-behave

4
推荐指数
1
解决办法
5214
查看次数

使用 gcloud 创建 Stackdriver 警报政策?(无需从文件加载)

所以我设置了一个通知通道:

gcloud alpha monitoring channels create \
    --description='test notification' \
    --display-name='test_channel' \
    --type=email \
    --channel-labels=email_address=example@gmail.com
Run Code Online (Sandbox Code Playgroud)

但我似乎无法获得与命令行一起使用的警报策略(尝试避免使用从文件加载,因为我需要使用模板)。看起来这应该有效:

gcloud alpha monitoring policies create \
    --notification-channels=test_channel \
    --aggregation='{"alignmentPeriod": "60s","perSeriesAligner": "ALIGN_MEAN"}' \
    --condition-display-name='CPU Utilization >0.80 for 10m'\
    --condition-filter='metric.type="appengine.googleapis.com/flex/instance/cpu/utilization" resource.type="gae_instance"' \
    --duration='1min' \
    --if='> 0.80' \
    --display-name='test alert'
Run Code Online (Sandbox Code Playgroud)

但它返回:

[--aggregation] 的值无效:仅当还指定了 --condition-filter 时才应指定。

但是,正如您所看到的,上面有一个--condition-filter标志。我尝试重新排序它,使其--condition-filter出现在 之前--aggregation,但这会导致持续时间错误,尽管它已经与文档匹配,并且像=60s、那样的轻微编辑=1min或在 中 的时间附近添加引号--aggregation似乎没有帮助:

gcloud alpha monitoring policies create \
    --notification-channels=test_channel \
    --condition-filter='metric.type=appengine.googleapis.com/flex/instance/cpu/utilization resource.type=gae_instance' \
    --aggregation='{"alignmentPeriod": "20s","perSeriesAligner": "ALIGN_MEAN"}' …
Run Code Online (Sandbox Code Playgroud)

google-cloud-platform gcloud stackdriver

3
推荐指数
1
解决办法
2141
查看次数

How to Allure-behave 从测试用例生成报告。Allure 仅从一个测试用例生成一份报告

当我从这里使用此步骤两次时:

$ behave -f allure_behave.formatter:AllureFormatter -o %allure_result_folder% ./features
Run Code Online (Sandbox Code Playgroud)

进而

$ allure serve %allure_result_folder%
Run Code Online (Sandbox Code Playgroud)

总是有 1 个测试用例。我怎样才能设法总结测试用例?我想看测试用例。

我也运行了两次此代码:

behave -f allure_behave.formatter:AllureFormatter -o results ./features
Run Code Online (Sandbox Code Playgroud)

进而:

allure generate results/ -o report/
Run Code Online (Sandbox Code Playgroud)

但是,我仍然只有 1 个测试用例。

我想看到例如 类似的结果

python-behave allure

1
推荐指数
1
解决办法
9836
查看次数

0
推荐指数
1
解决办法
1534
查看次数