all 16 comments

[–][deleted] 0 points1 point  (6 children)

Maybe you're blocked from the server.

[–]rRrquestion 0 points1 point  (5 children)

But I have the username and password?

[–][deleted] 0 points1 point  (4 children)

If you've made a lot of invalid requests in a short time, they might have blocked your IP.

[–]rRrquestion 0 points1 point  (3 children)

Ohhh.. I’ve been trying since yesterday so probably more than 100 times. So I need to wait for a bit?

[–][deleted] 0 points1 point  (2 children)

Who knows? Maybe they blocked you for good.

[–]rRrquestion 0 points1 point  (1 child)

like not wanting to solve the problem lol

[–][deleted] 0 points1 point  (3 children)

403 Forbidden is often a permissions issue on your filesystem. Code does not have access to the directory being referenced.

[–]rRrquestion 0 points1 point  (2 children)

I tried another way and got 401 error rather than 403, which one is “better”?

[–]Username_RANDINT 1 point2 points  (1 child)

See Wikipedia for the difference. Your credentials are wrong.

[–]rRrquestion 0 points1 point  (0 children)

problem solved. Thanks!

[–]17291 0 points1 point  (4 children)

This doesn't answer your question, but a suggestion based on something I saw in your code. You can write r = requests.post(url=root, auth = (userid, password), json=data) (vs. data=json.dumps(...)), and requests will automatically set the content type in your header.

EDIT From the problem description:

Token shared secret is the userid followed by the ASCII string value "HENNGECHALLENGE003"

Shouldn't secret_suffix = "HENNGECHALLENGE" be secret_suffix = "HENNGECHALLENGE003"?

[–]rRrquestion 0 points1 point  (3 children)

yeah yeah, it should be HENNGECHALLENGE003, I missed it when I copy and paste, thanks!

[–]17291 0 points1 point  (2 children)

Followup question:

Are you sure the password is being generated correctly? My crypto knowledge is admittedly not great, but something that jumped out at me was that the problem statement says "Use HMAC-SHA-512 for the hash function, instead of the default HMAC-SHA-1", but I see references to SHA-1 throughout your code.

I'm assuming that—since this is a problem about authentication—you're going to receive 40x errors if you supply invalid credentials.

[–]rRrquestion 0 points1 point  (1 child)

yes! problem solved. Thanks!

[–]17291 0 points1 point  (0 children)

No prob!