Skip to content

网宿请求容易超时 #2

@mabangde

Description

@mabangde

网宿本身支持api 或者ak sk方式
单个ip请求太容易就导致请求频繁,建议加上批量,一次查询多个ip

#!/bin/bash
# Please remember to change the param (-H "X-Time-Zone") in this demo to the TimeZone you want in response

  username='example_username'
  apiKey='example_apiKey'
  date=`env LANG="en_US.UTF-8" date -u "+%a, %d %b %Y %H:%M:%S   GMT"`
  password=`echo -en "$date" | openssl dgst -sha1 -hmac $apiKey   -binary | openssl enc -base64`
  curl -i --url "https://open.chinanetcenter.com/api/tools/ip-info" \
  -X "POST" \
-H "X-Time-Zone:GMT+08:00" \
  -u "$username:$password" \
  -H "Date: $date" \
  -H "Accept: application/json" \
  -d '{
          "ip":   ["1.1.1.1", "2.2.2.2"]
  }'

非api 查询不会出现查询次数过多问题。且每次可查询20条,api查询未验证每次能查询多少条

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions