Python 如何跨越错误403 HTTP请求方法不允许

Python 如何跨越错误403 HTTP请求方法不允许,python,python-requests,Python,Python Requests,我正在尝试登录我的帐户,在一个证券交易所网站上,这样我就可以在一段时间内检索我的一些隐私信息。有人能帮我解决我面临的问题吗 我一直在尝试一些请求,如下所示: import requests headers = { 'Accept': 'application/json, text/plain, */*', 'Content-Type': '', 'DNT': '1', 'Origin': '', 'Referer': '', 'User-Agen

我正在尝试登录我的帐户,在一个证券交易所网站上,这样我就可以在一段时间内检索我的一些隐私信息。有人能帮我解决我面临的问题吗

我一直在尝试一些请求,如下所示:

import requests

headers = {
    'Accept': 'application/json, text/plain, */*',
    'Content-Type': '',
    'DNT': '1',
    'Origin': '',
    'Referer': '',
    'User-Agent': '',
}

login_data = {
    'email': 'myemail@myemail.com',
    'password': 'mypassword',
    'modulo': '2',
    'empresaId': '0',
}

with requests.session() as s:
    url = ""
    r = s.get(url, headers=headers)
    #print(r.content)

    r = s.post(url, data=login_data, headers=headers)

    print(r.content)
以及登录时的网络请求:

General:
Request URL: 
Request Method: POST
Status Code: 
Remote Address:
Referrer Policy: 

Response Headers:
access-control-allow-credentials: true
access-control-allow-headers: 
access-control-allow-methods: POST,GET,DELETE,PUT,OPTIONS
access-control-allow-origin: *
content-type: application/json; charset=utf-8
date: Tue, 14 May 2019 18:45:58 GMT
server: 
status: 
vary: Origin
x-powered-by: ASP.NET

Request Headers:
Provisional headers are shown
Accept: application/json, text/plain, */*
Content-Type: 
DNT: 1
Origin: 
Referer: 
User-Agent: 

Form Data:
email: rafael@gmail.com
password: willchangelater321
modulo: 2
empresaId: 0
我得到了以下错误:

b'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\n<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">\n<TITLE>ERROR: The request could not be satisfied</TITLE>\n</HEAD><BODY>\n<H1>403 ERROR</H1>\n<H2>The request could not be satisfied.</H2>\n<HR noshade size="1px">\nThis distribution is not configured to allow the HTTP request method that was used for this request. The distribution supports only cachable requests.\n\n<BR clear="all">\n<HR noshade size="1px">\n<PRE>\nGenerated by cloudfront (CloudFront)\nRequest ID: 9BribBZzu94aROtVCcWJLluXyum8k70iAqwEHO5AMYGKEUHRu1SaHA==\n</PRE>\n<ADDRESS>\n</ADDRESS>\n</BODY></HTML>'
b'\n\n错误:无法满足请求\n\n403错误\n无法满足请求。\n
\n此分发版未配置为允许用于此请求的HTTP请求方法。该分发仅支持可缓存的请求。\n\n
\n
\n\n由cloudfront(cloudfront)生成\n请求ID:9bzzu94arotvccwjlluxyum8k70iaqweho5amygkeuhru1saha=\n\n\n
您将POST请求发送到错误的URL尝试替换此行:

r = s.post(url, data=login_data, headers=headers)
关于这一点:

r = s.post("https://api.bbce.com.br/auth", data=login_data, headers=headers)
希望这有帮助