1.charles,ssl证书已经安装,且代理是127.0.0.1:8888
2.脚本中的proxies
proxies={
"http":"http://127.0.0.1:8888",
"https":"https://127.0.0.1:8888"
}
def delete(self,tag_id,group_id):
r=requests.post("https://qyapi.weixin.qq.com/cgi-bin/externalcontact/del_corp_tag",params={"access_token":self.token},json={
#tag_id是列表
"tag_id": tag_id,
#group_id是列表
"group_id": group_id
},proxies=proxies,
verify=False
)
运行后结果:
except (ProtocolError, socket.error) as err:
raise ConnectionError(err, request=request)
except MaxRetryError as e:
if isinstance(e.reason, ConnectTimeoutError):
# TODO: Remove this in 3.0.0: see #2811
if not isinstance(e.reason, NewConnectionError):
raise ConnectTimeout(e, request=request)
if isinstance(e.reason, ResponseError):
raise RetryError(e, request=request)
if isinstance(e.reason, _ProxyError):
raise ProxyError(e, request=request)
if isinstance(e.reason, _SSLError):
# This branch is for urllib3 v1.22 and later.
> raise SSLError(e, request=request)
E requests.exceptions.SSLError: HTTPSConnectionPool(host='qyapi.weixin.qq.com', port=443): Max retries exceeded with url: /cgi-bin/gettoken?corpid=wwa686deb64cca6454&corpsecret=Z6N4wKGTNlHSywYyNblIQttAphcOl-m-ybEsAdmVXCQ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1124)')))
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/requests/adapters.py:514: SSLError