import requests
import time
import json
# 配置
API_URL = 'https://api.olostep.com/v1'
API_KEY = '<your_olostep_api_key>'
HEADERS = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {API_KEY}'
}
# 开始时间用于延迟跟踪
start_time = time.time()
# 定义仅包含基本URL的有效负载
payload = {
"url": "https://stripe.com"
}
# 发起请求
response = requests.post(f'{API_URL}/maps', headers=HEADERS, json=payload)
# 计算延迟
latency = round((time.time() - start_time) * 1000, 2)
print(f"请求完成于 {latency}ms")
# 处理结果
data = response.json()
print(f"在Stripe网站上找到 {data['urls_count']} 个URL")
# 打印前10个URL作为示例
print("\n示例URL:")
for url in data['urls'][:10]:
print(f"- {url}")
# 将所有URL保存到文件以供进一步分析
with open('stripe_urls.json', 'w') as f:
json.dump(data, f, indent=2)
print(f"\n所有URL已保存到stripe_urls.json")