您好,欢迎访问代理记账网站
  • 价格透明
  • 信息保密
  • 进度掌控
  • 售后无忧

芝麻http和豌豆http使用

一、豌豆http

import requests

targetUrl = "http://myip.ipip.net"


api_url = 'api的网址'
a = requests.get(api_url).text
httpProxyServer = str(a).strip()
print(httpProxyServer)

proxies = {
    "http": 'http://{}'.format(httpProxyServer),
    "https": 'http://{}'.format(httpProxyServer),
}

# 请求url1
print("request ==============================")
resp = requests.get(targetUrl, proxies=proxies)
print(resp.status_code)
print(resp.text)

二、芝麻http

# 提取代理API接口,获取1个代理IP
api_url = "api的网址"
# 获取API接口返回的代理IP

proxy_ip = requests.get(api_url).text

# 用户名密码认证(私密代理/独享代理)
username = "账号"
password = "密码"
proxies = {
    "http": "http://%(user)s:%(pwd)s@%(proxy)s/" % {"user": username, "pwd": password, "proxy": proxy_ip},
    "https": "http://%(user)s:%(pwd)s@%(proxy)s/" % {"user": username, "pwd": password, "proxy": proxy_ip}
}

res = requests.get(url, headers=headers, proxies=proxies)
print(res.text)

分享:

低价透明

统一报价,无隐形消费

金牌服务

一对一专属顾问7*24小时金牌服务

信息保密

个人信息安全有保障

售后无忧

服务出问题客服经理全程跟进