小编jel*_*han的帖子

远程服务器返回错误:“(405) Method Not Allowed”

在针对同一线程阅读不同的答案后,我尝试了他们讨论中提到的几乎所有选项,但是我仍然遇到错误:

错误 1The remote server returned an error: (404) Not Found.

错误二The remote server returned an error: (405) Method Not Allowed

下面是我的代码:

var httpWebRequest = (HttpWebRequest)WebRequest.Create("URL?Paramter1=pc&user=u1&password=p1");
httpWebRequest.ContentType = "application/json; charset=utf-8";
httpWebRequest.Method = "POST";
httpWebRequest.Accept = "application/json";
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
Run Code Online (Sandbox Code Playgroud)

我在最后一行收到错误,即

var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
Run Code Online (Sandbox Code Playgroud)

如果我使用,httpWebRequest.Method="GET"我会收到上面提到的错误号 1,如果我使用,httpWebRequest.Method="Post"我会收到错误号 2。

c#

5
推荐指数
1
解决办法
2万
查看次数

grafana 显示来自 API 的文本/字符串值

如何使用从JSON API 插件获取的数据在 Grafana 中显示文本/字符串值?

我的数据源网址是https://bensapi.pythonanywhere.com/返回:

{"message":"Hello from Flask!","status":"success"}
Run Code Online (Sandbox Code Playgroud)

为此 URL 设置数据源,EXPLORE 选项可以正常工作,底部的字符串就是我要显示的内容:

在此输入图像描述

在grafana中选择这种类型的图表:

在此输入图像描述

并尝试从数据源的探索过程中重新创建我的步骤,我似乎无法Hello from Flask在仪表板上绘制字符串。任何提示表示赞赏。

在此输入图像描述

grafana

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

有什么方法可以确定时间输入是部分填充还是空白?

我有一个<input type="time">. Chrome 允许用户部分填写输入。例如,用户输入小时但不输入分钟,或者反之亦然。有没有办法使用 JavaScript 来检查该元素是否为空或部分填充?

value只要输入仅部分填充,该属性就是空的。所以那个不行。有没有可以利用的财产?

实际上我对部分输入的值不感兴趣。只是想通过警告没有小时或分钟的时间无效并将被忽略来改善用户体验。

JSBin https://jsbin.com/pikabowoyo/edit?html,js,output

let el = document.querySelector('button');
el.addEventListener('click', function() {
  let input = document.querySelector('input');
  console.log(input.value);
});
Run Code Online (Sandbox Code Playgroud)
<input type="time">
<button>show value</button>
Run Code Online (Sandbox Code Playgroud)

html javascript dom

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

为Facebook对象创建链接广告(事件网址)

在业务经理中,可以使用Facebook活动网址创建链接广告.我喜欢使用Facebook Ads API执行相同操作但面临权限错误.

在业务经理中创建的广告的广告素材如下所示:

{
    "object_story_spec": {
        "page_id": "24188824589????",
        "link_data": {
            "link": "https://www.facebook.com/events/25595316793????/",
            "message": "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
            "image_hash": "cbb1f226fd5fe47c826dd1cad117????"
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

当我尝试通过广告Api创建相同的广告素材时,我收到如下错误消息:

{
  "error": {
    "message": "Invalid parameter",
    "type": "FacebookApiException",
    "code": 100,
    "error_subcode": 1349118,
    "is_transient": false,
    "error_user_title": "Disallowed Post Link",
    "error_user_msg": "One or more of the given URLs is not allowed by the Stream post URL security app setting. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains. …
Run Code Online (Sandbox Code Playgroud)

facebook facebook-graph-api facebook-ads-api

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

json.map 不是函数

json.map 不是函数 - 使用 Node-fetch 时出现此错误

获取方法

JSON 获取结果

{"status":200,"email":"email@example.com","domain":"example.com","mx":false,"disposable":false,"alias":false,"did_you_mean":null,"remaining_requests":99}
Run Code Online (Sandbox Code Playgroud)

我想在节点 CLI 表上打印此内容

    const printContent = json => {
    console.log()

      const group = json.map(g => [
        g.status,
        g.email
      ])

      const table = new Table({
        head: ["Name", "Email"],
        colWidths: [20, 20]
      })

      table.push(...group)
      console.log(table.toString())
  }
Run Code Online (Sandbox Code Playgroud)

json node.js

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

谷歌云承载令牌到期

为了将文件上传到谷歌云存储桶,我使用的是 JSON API。为此,我使用以下命令创建了一个 Bearer Token

$> gcloud auth activate-service-account myaccount@gserviceaccounts.co --key-file=creds.json 
$> gcloud auth print-access-token
Run Code Online (Sandbox Code Playgroud)

现在我得到了一个令牌。我想知道,它是一个终生令牌,或者它有一些到期日。

google-cloud-storage bearer-token gcloud

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