Py学习  »  docker

Chrome在docker容器中返回状态码400

Tralots • 5 年前 • 1550 次点击  

铬合金参数 ("--headless", "--no-sandbox", "--disable-dev-shm-usage")

directConnection: true,
disableChecks: true

能力:

acceptInsecureCerts: true
acceptSslCerts: true

我还在.env文件中添加了以下内容:

NODE_TLS_REJECT_UNAUTHORIZED=0

{
  method: 'Network.responseReceived',
  params: {
    frameId: '721A00F872D1255AA1DAE58D2DF5D75E',
    loaderId: '70EAE0F82B0AB6BDE6489BC26D77DA34',
    requestId: '117.239',
    response: {
      connectionId: 309,
      connectionReused: true,
      encodedDataLength: 123,
      fromDiskCache: false,
      fromPrefetchCache: false,
      fromServiceWorker: false,
      headers: [Object],
      mimeType: 'application/problem+json',
      protocol: 'h2',
      remoteIPAddress: 'remote ip',
      remotePort: 443,
      securityDetails: [Object],
      securityState: 'insecure',
      status: 400,
      statusText: '',
      timing: [Object],
      url: 'https://api call link'
    },
    timestamp: 15184.562748,
    type: 'XHR'
  }
}
{
  method: 'Network.dataReceived',
  params: {
    dataLength: 185,
    encodedDataLength: 0,
    requestId: '117.239',
    timestamp: 15184.562954
  }
}
{
  method: 'Network.dataReceived',
  params: {
    dataLength: 0,
    encodedDataLength: 203,
    requestId: '117.239',
    timestamp: 15184.563471
  }
}
{
  method: 'Network.loadingFinished',
  params: {
    encodedDataLength: 326,
    requestId: '117.239',
    shouldReportCorbBlocking: false,
    timestamp: 15184.552973
  }
}

需要注意的是,当在docker容器外部本地运行时,此函数按预期工作,并且API调用返回状态代码:200

P、 美国在Zelenium运行的结果和docker本地运行的结果相同。

Failed to load resource: the server responded with a status of 400 ()
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/55121
 
1550 次点击  
文章 [ 1 ]  |  最新文章 5 年前