I'd like to access my homepage through Python requests.
import requests
URL = 'http://cyphers.herokuapp.com'
payload = {
'myName': 'Good Adult',
}
session = requests.session()
r = requests.post(URL, data=payload)
print(r.text)
However, the results are as follows:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>405 Method Not Allowed</title>
<h1>Method Not Allowed</h1>
<p>The method is not allowed for the requested URL.</p>
html code.
<p class="a">
<form action = "./output" method = "post">
<p>Enter your nickname:</p>
<p><input type = "text" name = "myName" /></p>
<p><input type="radio" name="gametype" value="rating" checked="checked"> Official
<input type="radio" name="gametype" value="normal">General</p>
<p><input type = "submit" value = "submit" /></p>
</form>
</p>
Did you designate the wrong place?
python urllib http requests
http://cyphers.herokuapp.com
is a screen that shows a form that searches for a record by entering a nickname, and isn't that form sending a POST request to http://cyphers.herokuapp.com/output/
that you are trying to access (and the new script)? If so, use URL
from the source you gave us.
URL = 'http://cyphers.herokuapp.com/output/'
I think it will be processed if you change it to .
+ What's wrong?: HTTP 405
is an error that says, "You cannot access this resource with that method right now." The POST
request must not be sent to cyphers.herokuapp.com/
. (@app.route()
instead of@app.get()
)
+ You are using heroku address, which starts with http://
, but in fact, Heroku supports HTTPS. We recommend replacing it with https://cyphers.herokuapp.com
.
© 2024 OneMinuteCode. All rights reserved.