Rest 如何修复邮递员中的403禁止错误

Rest 如何修复邮递员中的403禁止错误,rest,http,http-status-code-403,Rest,Http,Http Status Code 403,我正试图从atp排名网站中获取数据: 所以我试着获取这个URL,但我有一个错误代码:“403禁止”和邮递员。我在其他网站上没有类似的错误代码 ATP没有API,所以我想刮取该网站,但似乎刮取在该网站上是不允许的,您有解决方案吗 谢谢 问题是我不知道请求中要包含的标题 有时它在Postman中起作用,但我的express JS应用程序中仍然会出现错误: config: { adapter: [Function: httpAdapter], transformRequest:

我正试图从atp排名网站中获取数据:

所以我试着获取这个URL,但我有一个错误代码:“403禁止”和邮递员。我在其他网站上没有类似的错误代码

ATP没有API,所以我想刮取该网站,但似乎刮取在该网站上是不允许的,您有解决方案吗

谢谢


问题是我不知道请求中要包含的标题

有时它在Postman中起作用,但我的express JS应用程序中仍然会出现错误:

  config: {
    adapter: [Function: httpAdapter],
    transformRequest: { '0': [Function: transformRequest] },
    transformResponse: { '0': [Function: transformResponse] },
    timeout: 0,
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    validateStatus: [Function: validateStatus],
    headers: {
      Accept: 'application/json, text/plain, */*',
      'User-Agent': 'axios/0.18.1'
    },
    method: 'get',
    url: 'https://www.atptour.com/en/rankings/singles',
    data: undefined
  },
  request: <ref *1> ClientRequest {
    _events: [Object: null prototype] {
      socket: [Function (anonymous)],
      abort: [Function (anonymous)],
      aborted: [Function (anonymous)],
      error: [Function (anonymous)],
      timeout: [Function (anonymous)],
      prefinish: [Function: requestOnPrefinish]
    },
    _eventsCount: 6,
    _maxListeners: undefined,
    outputData: [],
    outputSize: 0,
    writable: true,
    destroyed: false,
    _last: true,
    chunkedEncoding: false,
    shouldKeepAlive: false,
    _defaultKeepAlive: true,
    useChunkedEncodingByDefault: false,
    sendDate: false,
    _removedConnection: false,
    _removedContLen: false,
    _removedTE: false,
    _contentLength: 0,
    _hasBody: true,
    _trailer: '',
    finished: true,
    _headerSent: true,
    socket: TLSSocket {
      _tlsOptions: [Object],
      _secureEstablished: true,
      _securePending: false,
      _newSessionPending: false,
      _controlReleased: true,
      secureConnecting: false,
      _SNICallback: null,
      servername: 'www.atptour.com',
      alpnProtocol: false,
      authorized: true,
      authorizationError: null,
      encrypted: true,
      _events: [Object: null prototype],
      _eventsCount: 10,
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: 'www.atptour.com',
      _readableState: [ReadableState],
      _maxListeners: undefined,
      _writableState: [WritableState],
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: undefined,
      _server: null,
      ssl: [TLSWrap],
      _requestCert: true,
      _rejectUnauthorized: true,
      parser: null,
      _httpMessage: [Circular *1],
      [Symbol(res)]: [TLSWrap],
      [Symbol(verified)]: true,
      [Symbol(pendingSession)]: null,
      [Symbol(async_id_symbol)]: 13,
      [Symbol(kHandle)]: [TLSWrap],
      [Symbol(kSetNoDelay)]: false,
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: null,
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kCapture)]: false,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(connect-options)]: [Object],
      [Symbol(RequestTimeout)]: undefined
    },
    _header: 'GET /en/rankings/singles HTTP/1.1\r\n' +
      'Accept: application/json, text/plain, */*\r\n' +
      'User-Agent: axios/0.18.1\r\n' +
      'Host: www.atptour.com\r\n' +
      'Connection: close\r\n' +
      '\r\n',
    _keepAliveTimeout: 0,
    _onPendingData: [Function: noopPendingOutput],
    agent: Agent {
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      defaultPort: 443,
      protocol: 'https:',
      options: [Object],
      requests: {},
      sockets: [Object],
      freeSockets: {},
      keepAliveMsecs: 1000,
      keepAlive: false,
      maxSockets: Infinity,
      maxFreeSockets: 256,
      scheduling: 'fifo',
      maxTotalSockets: Infinity,
      totalSocketCount: 1,
      maxCachedSessions: 100,
      _sessionCache: [Object],
      [Symbol(kCapture)]: false
    },
    socketPath: undefined,
    method: 'GET',
    maxHeaderSize: undefined,
    insecureHTTPParser: undefined,
    path: '/en/rankings/singles',
    _ended: true,
    res: IncomingMessage {
      _readableState: [ReadableState],
      _events: [Object: null prototype],
      _eventsCount: 3,
      _maxListeners: undefined,
      socket: [TLSSocket],
      httpVersionMajor: 1,
      httpVersionMinor: 1,
      httpVersion: '1.1',
      complete: true,
      headers: [Object],
      rawHeaders: [Array],
      trailers: {},
      rawTrailers: [],
      aborted: false,
      upgrade: false,
      url: '',
      method: null,
      statusCode: 403,
      statusMessage: 'Forbidden',
      client: [TLSSocket],
      _consuming: true,
      _dumped: false,
      req: [Circular *1],
      responseUrl: 'https://www.atptour.com/en/rankings/singles',
      redirects: [],
      [Symbol(kCapture)]: false,
      [Symbol(RequestTimeout)]: undefined
    },
    aborted: false,
    timeoutCb: null,
    upgradeOrConnect: false,
    parser: null,
    maxHeadersCount: null,
    reusedSocket: false,
    host: 'www.atptour.com',
    protocol: 'https:',
    _redirectable: Writable {
      _writableState: [WritableState],
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      _options: [Object],
      _redirectCount: 0,
      _redirects: [],
      _requestBodyLength: 0,
      _requestBodyBuffers: [],
      _onNativeResponse: [Function (anonymous)],
      _currentRequest: [Circular *1],
      _currentUrl: 'https://www.atptour.com/en/rankings/singles',
      [Symbol(kCapture)]: false
    },
    [Symbol(kCapture)]: false,
    [Symbol(kNeedDrain)]: false,
    [Symbol(corked)]: 0,
    [Symbol(kOutHeaders)]: [Object: null prototype] {
      accept: [Array],
      'user-agent': [Array],
      host: [Array]
    }
  },
  response: {
    status: 403,
    statusText: 'Forbidden',
    headers: {
      date: 'Fri, 21 May 2021 18:27:42 GMT',
      'content-type': 'text/html; charset=UTF-8',
      'transfer-encoding': 'chunked',
      connection: 'close',
      'cf-chl-bypass': '1',
      'permissions-policy': 'accelerometer=(),autoplay=(),camera=(),clipboard-read=(),clipboard-write=(),fullscreen=(),geolocation=(),gyroscope=(),hid=(),interest-cohort=(),magnetometer=(),microphone=(),payment=(),publickey-credentials-get=(),screen-wake-lock=(),serial=(),sync-xhr=(),usb=()',
      'cache-control': 'private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0',
      expires: 'Thu, 01 Jan 1970 00:00:01 GMT',
      'x-frame-options': 'SAMEORIGIN',
      'cf-request-id': '0a31c7fa700000ee0f36b38000000001',
      'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
      'set-cookie': [Array],
      server: 'cloudflare',
      'cf-ray': '652fdc3d7c82ee0f-CDG'
    },
    config: {
      adapter: [Function: httpAdapter],
      transformRequest: [Object],
      transformResponse: [Object],
      timeout: 0,
      xsrfCookieName: 'XSRF-TOKEN',
      xsrfHeaderName: 'X-XSRF-TOKEN',
      maxContentLength: -1,
      validateStatus: [Function: validateStatus],
      headers: [Object],
      method: 'get',
      url: 'https://www.atptour.com/en/rankings/singles',
      data: undefined
    },
    request: <ref *1> ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 6,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      destroyed: false,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: false,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      _contentLength: 0,
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      socket: [TLSSocket],
      _header: 'GET /en/rankings/singles HTTP/1.1\r\n' +
        'Accept: application/json, text/plain, */*\r\n' +
        'User-Agent: axios/0.18.1\r\n' +
        'Host: www.atptour.com\r\n' +
        'Connection: close\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: noopPendingOutput],
      agent: [Agent],
      socketPath: undefined,
      method: 'GET',
      maxHeaderSize: undefined,
      insecureHTTPParser: undefined,
      path: '/en/rankings/singles',
      _ended: true,
      res: [IncomingMessage],
      aborted: false,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: 'www.atptour.com',
      protocol: 'https:',
      _redirectable: [Writable],
      [Symbol(kCapture)]: false,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype]
    },
config:{
适配器:[功能:httpAdapter],
transformRequest:{0':[函数:transformRequest]},
transformResponse:{0':[函数:transformResponse]},
超时:0,
xsrfCookieName:'XSRF-TOKEN',
xsrfHeaderName:'X-XSRF-TOKEN',
maxContentLength:-1,
validateStatus:[函数:validateStatus],
标题:{
接受:“application/json,text/plain,*/*”,
“用户代理”:“axios/0.18.1”
},
方法:“get”,
网址:'https://www.atptour.com/en/rankings/singles',
数据:未定义
},
请求:ClientRequest{
_事件:[对象:空原型]{
套接字:[函数(匿名)],
中止:[函数(匿名)],
已中止:[函数(匿名)],
错误:[函数(匿名)],
超时:[函数(匿名)],
Prefish:[函数:RequestOnPrefish]
},
_活动地点:6,
_maxListeners:未定义,
输出数据:[],
输出大小:0,
可写:对,
销毁:错误,
_最后:是的,
错误:错误,
应该保持生命:错,
_defaultKeepAlive:对,
useChunkedEncodingByDefault:false,
发送日期:false,
_removedConnection:false,
_removedContLen:错误,
_removedTE:错,
_contentLength:0,
_哈斯博迪:是的,
_预告片:'',
完成:对,
_海德森:是的,
插座:TLSSocket{
_tlsOptions:[对象],
_是的,,
_securePending:false,
_新闻:假,
_对,,
安全连接:false,
_返回:null,
服务器名:“www.atptour.com”,
阿尔卑斯山本:错,
授权:对,
authorizationError:null,
加密:对,
_事件:[对象:空原型],
_活动日期:10,,
连接:错,
_haderro:false,
_父项:null,
_主持人:“www.atptour.com”,
_readableState:[readableState],
_maxListeners:未定义,
_可写状态:[可写状态],
AllowAllOpen:错误,
_sockname:null,
_pendingData:null,
_彭丁编码:'',
服务器:未定义,
_服务器:空,
ssl:[TLSWrap],
_requestCert:对,
_对,对,
解析器:null,
_httpMessage:[循环*1],
[Symbol(res)]:[TLSWrap],
[符号(已验证)]:正确,
[符号(挂起会话)]:空,
[符号(异步\u id\u符号)]:13,
[符号(坎德尔)]:[TLSWrap],
[符号(kSetNoDelay)]:false,
[符号(LastWriteEqueSize)]:0,
[符号(超时)]:空,
[符号(kBuffer)]:空,
[符号(kBufferCb)]:空,
[符号(kBufferGen)]:空,
[符号(kCapture)]:假,
[符号(千字节数)]:0,
[符号(kbyteswrited)]:0,
[符号(连接选项)]:[对象],
[符号(请求超时)]:未定义
},
_标题:“GET/en/rankings/singles HTTP/1.1\r\n”+
'接受:application/json,text/plain,*/*\r\n'+
'用户代理:axios/0.18.1\r\n'+
'主机:www.atptour.com\r\n'+
'连接:关闭\r\n'+
“\r\n”,
_keepAliveTimeout:0,
_onPendingData:[函数:noopPendingOutput],
代理人:代理人{
_事件:[对象:空原型],
_事件提示:2,
_maxListeners:未定义,
默认端口:443,
协议:“https:”,
选项:[对象],
请求:{},
套接字:[对象],
自由套接字:{},
keepAliveMsecs:1000,
keepAlive:错,
maxSockets:无限,
maxFreeSockets:256,
调度:“fifo”,
maxTotalSockets:无限,
totalSocketCount:1,
maxCachedSessions:100,
_sessionCache:[对象],
[符号(kCapture)]:false
},
socketPath:未定义,
方法:“GET”,
maxHeaderSize:未定义,
不安全的HttpParser:未定义,
路径:'/en/排名/单打',
_结束:对,
res:收入信息{
_readableState:[readableState],
_事件:[对象:空原型],
_事件提示:3,
_maxListeners:未定义,
套接字:[TLSSocket],
httpVersionMajor:1,
httpVersionMinor:1,
httpVersion:'1.1',
完全正确,
标题:[对象],
rawHeaders:[数组],
预告片:{},
Raw:[],
中止:错误,
升级:false,
url:“”,
方法:null,
状态代码:403,
状态消息:“禁止”,
客户:[TLSSocket],
_消费:是的,
_是假,,
请求:[通告*1],
回答:L'https://www.atptour.com/en/rankings/singles',
重定向:[],
[符号(kCapture)]:假,
[符号(请求超时)]:未定义
},
中止:错误,
timeoutCb:null,
升级或连接:false,
解析器:null,
maxHeadersCount:null,
reusedSocket:false,
主持人:“www.atptour.com”,
协议:“https:”,
_可重定向:可写{
_可写状态:[可写状态],
_事件:[对象:空原型],
_事件提示:2,
_maxListeners:未定义,
_选项:[对象],
_重定向计数:0,
_重定向:[],
_requestBodyLength:0,
_requestBodyBuffers:[],
_onNativeResponse:[函数(匿名)],
_当前请求:[通告*1],
_当前URL:'https://www.atptour.com/en/rankings/singles',
[符号(kCapture)]:false
},
[符号