Something like the doc?
i try but nothing
import requests
payload = {‘username’: ‘mychris’, ‘password’: ‘mypassword’}
r = requests.get(“https://www.hackthis.co.uk/login”, params=payload)
data = r.content # Content of response
print r.status_code # Status code of response
print r.url
print data
respond :
404
https://www.hackthis.co.uk/login?username=mychris&password=mypassword
Error accessing resource
I do this prog :
import requests
s = requests.Session()
s.auth = (‘mychris’, ‘mypassword’)
r = s.get(“https://www.hackthis.co.uk”)
print r.text
But not connexion, just the page connexion
……
}
</script>
<form id="login_form" action="?login" method="POST">
<label for="username">Username:</label>
<input type="text" name="username" id="username">
<label for="password">Password:</label>
<input type="password" name="password" id="password">
<a class="white" href="/?request">Forgot details?</a>
<input type="submit" value="Login" class="button">
</form>
<a class='stop-ex
………
To make things clear, you need to make a POST request to the page https://www.hackthis.co.uk?login as you can see in this HTML line : <form id="login_form" action="?login" method="POST">
The parameters need to have the right name i.e. username and password. Those parameters need to be sent via POST.
import requests
payload = {‘username’: ‘mychris’, ‘password’: ‘mypassword’}
s = requests.Session()
r = s.post(“https://www.hackthis.co.uk/login”, params=payload)
print r.text
print r.status_code # Status code of response
print r.url
When i do this prog :
Error accessing resource
404
https://www.hackthis.co.uk/login?username=mychris&password=mypassword
if i do with “https://www.hackthis.co.uk” :
page html with formulaire login
i try with POST and GET but same error
Shame on me :s
http://python-requests.org has french section
Your problem doesn’t come from the module you are using, but from the URL you are trying to reach.
The login page is actually the main root page, but with the login get parameter.
So your code should be r = s.post("https://www.hackthis.co.uk/?login", data=payload)
instead of r = s.post("https://www.hackthis.co.uk/login", data=payload)
Such a tiny thing that can make you lose so much time :)
True,
the ? before login was the problem for connect me
Thank you very much !!!!!
Now new defi ,
i must keep the connection (because if i do with “https://www.hackthis.co.uk/levels/coding/1” i see the problem on login) ,
go to https://www.hackthis.co.uk/levels/coding/1
take
Words: but, has, why, when, did, said, and, there, only, what, does, were, that, your, nor, able, either, every, these, into, the, other, she, him, with, our, all, least, likely, how, get, hers, her, about, are, his, twas, ever, who, might, also, got, would, whom, own, yet, then, some, often, while and POST respond in Answer: Time remaining: 0.00 secondsI will have a big job for resolve this level :p
Hi, I also used Python for this challenge, it work when I log in and get the text but when I post the answer using the following 2 lines they do not seem to work:
Data = {‘answer’: ans}
res = sess.post(“https://defendtheweb.net/playground/alphabetize”, data=Data)
If anyone would spare some minutes to look at this part of my code I would really appreciate it.
Thank you in advance!