- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当我使用python携带cookie发送模拟请求到https://www.amazon.com/gp/delivery/ajax/address-change.html
回复 \n\n
将被退回。但是当我使用 Charles 作为中间人代理时,同样的 http 消息正常响应。
同样,当你使用nodejs发送模拟请求时,也可以得到正常的响应。我在python中尝试了三个不同的网络请求库,requests、httpx和aiohttp得到了相同的结果。
对于\n\n
的回复,我将问题锁定在python请求的tls握手包上。修改后urllib3.util.ssl_.DEFAULT_CIPHERS
,它仍然返回 \n\n
的响应.
和Wireshark抓包对比后发现,除了CIPHERS部分,Signature Algorithm部分也是固定的,三个请求库的Signature Algorithm部分都是一样的,用curl的方式,nodejs的方式, Charles的方式,Chrome获取TSL Client Hello包的方式。这是不一样的。
我想将 Python TSL Client Hello 包的签名算法部分模拟到 Chrome 中。在我DEBUG了python请求库的源码后,发现openssl so文件中似乎存在SSL Signature Algorithm部分控件。
这个问题困扰了我很久,希望能解决,非常感谢
import requests
from aiohttp import ClientSession
import httpx
cookies = {
'csm-hit': 'tb:s-B8ZK0QTPQCGWKHY3QDT5|1620287052879&t:1620287054928&adb:adblk_no',
'i18n-prefs': 'USD',
'lc-main': 'en_US',
'session-id': '143-0501748-3847056',
'session-id-time': '2082787201l',
'session-token': 'NxLWWkB7RnpUvmQEl7OcUzk44D9PnlSt/swrqvnSwBvry9WAPSeQt5U2hVCa7IeEEDwj+qzLHwrNhCnA+7pN8H7HELP5WYZuPjtTJ1d8jrTxLueLIQB+wh+3e+1c1vRrfYDa4FTsdm6jN2QR55zq0ybhNJt0jrXCTdlaktZ+e0tHPIjQnCsu1lidMvyOksR+',
'skin': 'noskin',
'sp-cdn': 'L5Z9:CN',
'ubid-main': '134-5202210-0613519',
}
headers = {
'Host': 'www.amazon.com',
'user-agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 UBrowser/6.2.4094.1',
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
'accept-language': 'zh-CN,zh;q=0.9',
'anti-csrftoken-a2z': 'gBtJDelwICZ60r+pGBgwbzjAf4Wr+LTRIoyWRyMAAAAMAAAAAGC1xeJyYXcAAAAA',
'content-type': 'application/x-www-form-urlencoded;charset=utf-8',
}
data = 'locationType=LOCATION_INPUT&zipCode=90001&storeContext=generic&deviceType=web&pageType=Gateway&actionSource=glow&almBrandId=undefined'
url = 'https://www.amazon.com/gp/delivery/ajax/address-change.html'
# url = 'https://www.python-spider.com/nginx'
your_proxy_url = 'http://127.0.0.1:8888'
# your_proxy_url = ''
#
with httpx.Client(
# http2=True,
# proxies=your_proxy_url,
verify=False) as client:
# This HTTP request will be tunneled instead of forwarded.
response = client.post(url=url, headers=headers, cookies=cookies, data=data)
print(response.status_code)
print(response.text)
# cert='/Users/yangyanhui/lbs/spider/amazon/amazon_cookie_pool/charles-ssl-proxying-certificate.pem'
response = requests.post(url, headers=headers, cookies=cookies, data=data)
print(response.status_code)
print(response.text)
import aiohttp, asyncio
# asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) # 加上这一行
async def main(): # aiohttp必须放在异步函数中使用
async with ClientSession(cookies=cookies, headers=headers) as session:
async with session.post(url, data=data,
# proxy=your_proxy_url,
verify_ssl=False) as resp:
print(await resp.text())
print(resp.status)
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
curl -H 'Host: www.amazon.com' -H 'Cookie: csm-hit=tb:s-B8ZK0QTPQCGWKHY3QDT5|1620287052879&t:1620287054928&adb:adblk_no; i18n-prefs=USD; lc-main=en_US; session-id=143-0501748-3847056; session-id-time=2082787201l; session-token=NxLWWkB7RnpUvmQEl7OcUzk44D9PnlSt/swrqvnSwBvry9WAPSeQt5U2hVCa7IeEEDwj+qzLHwrNhCnA+7pN8H7HELP5WYZuPjtTJ1d8jrTxLueLIQB+wh+3e+1c1vRrfYDa4FTsdm6jN2QR55zq0ybhNJt0jrXCTdlaktZ+e0tHPIjQnCsu1lidMvyOksR+; skin=noskin; sp-cdn=L5Z9:CN; ubid-main=134-5202210-0613519' -H 'user-agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 UBrowser/6.2.4094.1' -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' -H 'accept-language: zh-CN,zh;q=0.9' -H 'anti-csrftoken-a2z: gBtJDelwICZ60r+pGBgwbzjAf4Wr+LTRIoyWRyMAAAAMAAAAAGC1xeJyYXcAAAAA' -H 'content-type: application/x-www-form-urlencoded;charset=utf-8' --data-binary "locationType=LOCATION_INPUT&zipCode=90001&storeContext=generic&deviceType=web&pageType=Gateway&actionSource=glow&almBrandId=undefined" --compressed 'https://www.amazon.com/gp/delivery/ajax/address-change.html'
最佳答案
也许考虑使用有一个包的 golang 可以修改你的 tls 指纹
关于ssl - 使用python爬虫发送亚马逊修改邮政编码接口(interface)时遇到疑似TLS指纹风控,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68032039/
我正在编写一个 VBA 脚本,用于查找指定半径内的邮政编码。我有一个 Access 数据库,表中有多个记录。每条记录在表中都有一个名称、地址和邮政编码字段。 Access 时的 VBA 代码提示用户输
我遇到了以下问题: 定义一个函数 postalValidate(S) ,它首先检查 S 是否代表一个有效的邮政编码:首先,删除所有空格;余数必须是 L#L#L# 的形式,其中 L 是字母(小写或大写)
我试图仅检索此脚本中的邮政编码字段。 有没有办法只返回这个值? function LookuptableWend(query) { var tr = document.get
我正在开发一个自定义验证器来验证和替换(如果可能)邮政编码。这是荷兰邮政编码,应类似于“5050 AA”。当用户输入“5050AA”时,该邮政编码应替换为“5050 AA”。我通过将以下脚本添加到我的
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 要求提供代码的问题必须表现出对所解决问题的最低限度的了解。包括尝试的解决方案、为什么它们不起作用以及预期结果
我有一个工作板,用户可以通过 Google-Maps API 提交他的位置,该 API 在 map 上绘制工作。 问题是,因为它是一个基于位置的工作板,所以我想允许最广泛的输入是邮政编码(这样用户可以
在我的 php 文件上使用此功能时,我不断出现空屏幕,XML 文件中没有属性 // Get parameters from URL $center_lat = ( isset( $_GET["
我如何防止接收带有子站点的城市并只接收最大的村庄。 示例: 目前我得到 2 条记录,第一个是主要城市,第二个是邻居。但我只想要主要城镇。 CH 8280 Kreuzlingen CH
对不起,我迷路了。我正在尝试构建一个搜索页面,该页面使用英国邮政编码或位置来查找气枪网站(我们称它们为“商店”,这样我就不必向那些不知道气枪是什么的人解释),每个store 我在邮政编码、县、城镇/城
我对 SQL 查询有点困惑。 用户应该能够搜索邮政编码、公司名称或位置 我有下表: 公司表 companyid | name | location 1 Sh
是的,我一直在努力研究如何将给定的邮政编码与商店地址的数据库进行比较,并根据哪个最接近给定的邮政编码(我猜是邮政编码)对它们进行排序。 这主要是出于兴趣,而不是我征求你的意见然后卖给客户:-O 首先,
我想从地址字符串中提取阿尔伯塔(加拿大)地区的邮政编码。 例如: addr = '12345-67 Ave, Edmonton, AB T1A 2B3, Canada' 应该提取T1A 2B3。 匹
我需要重新格式化英国邮政编码列表,并从以下内容开始去除空格和大写: postcode.upcase.gsub(/\s/,'') 我现在需要更改邮政编码,以便新邮政编码的格式与以下正则表达式匹配: ^(
我创建了一个基于列名检索范围的函数。这是我的代码: Sub sep_Filter() Dim zip_rng As String With Sheet2 zip_rng
获取给定国家的给定邮政编码/邮政编码的坐标(纬度/经度)的最完整、精确和可靠的方法是什么?我需要发出大量请求,因此高 API 限制率(甚至可能不存在)会很有用。 GeoNames转储会很酷,但它似乎有
关闭。这个问题需要多问focused 。目前不接受答案。 想要改进此问题吗?更新问题,使其仅关注一个问题 editing this post . 已关闭 8 年前。 Improve this ques
如何在 Opencart 版本 2.1.0.2 的付款方式选项卡中发布发货城市或邮政编码的数据 我想将 COD 限制在某些城市。有人可以帮我吗? 最佳答案 创建自定义表来存储可用的邮政编码。为产品列表
将其设置为名为customers / customer的索引/类型。 此集合的每个文档都有一个邮政编码属性。 邮政编码基本上可以像这样: 字符串-字符串(例如:8907-1009) 字符串字符串(例如
我现在正在使用 Map Kit 和 Core Location,需要从邮政编码或城市/州获取位置信息。有什么办法吗? 最佳答案 您可以使用 CLGeocoder支持将地址转换为坐标以及反向转换的类。例
我当前的应用程序需要存储用户的地址信息。我目前正在争论是使用惯用的街道地址/城市/州/ zip 文本框和下拉菜单,还是采用 Google 的方法,将所有内容都放在一行上。关于以这两种方式存储地址信息的
我是一名优秀的程序员,十分优秀!