Doubt about POST Challenge Working with the reddit API

Hello again.

As a newbie I find it incredible to make use of the functionalities of an API in a programmatic way.

The possibility of being able to vote what interests you is very interesting that’s why I want to know what I’m doing on it, however I have no choice to come here and trust that someone sees a little further than me.

Here’s what I have: :

data = {'grant_type': 'password',
        'username': 'user_name',
        'password': reddit_password }

payload = {"dir": 1, "id":thread}


base_url  = "https://oauth.reddit.com/"

auth = requests.auth.HTTPBasicAuth(CLIENT_ID, SECRET_KEY)
r = requests.post(base_url + 'api/vote',
                  data=data,
                  headers={'user-agent': 'tutorialAPI by username'},
                  params = payload,
                  auth=auth)
status = response.status_code

print(r.text)
status

What I expected to happen:

200 and some type of message confirming the vote (¿?).

I have read (perhaps I have not understood it well) that this type of practices to be able to be automated are monitored in a “human” way, if this were so it would have a delay, but I do not think that even my request for a vote will arrive.

What actually happened:

<html><body><h1>403 Forbidden</h1>
Request forbidden by administrative rules.
</body></html>

403

:face_with_hand_over_mouth:

As always thank you very much to everyone.

See you.

A&E.

That’s a permissionss error.

403 Forbidden

The HTTP 403 Forbidden response status code indicates that the server understands the request but refuses to authorize it.

This status is similar to 401, but for the 403 Forbidden status code re-authenticating makes no difference. The access is permanently forbidden and tied to the application logic, such as insufficient rights to a resource.

Source.

In other words, you don’t have permissions. Are you sure that you were able to authenticate? Can you do whatever action you’re trying to do in the browser?

In other words, you don’t have permissions.

yes, I knew that.

Are you sure that you were able to authenticate?
yes

base_url = 'https://www.reddit.com/'

auth = requests.auth.HTTPBasicAuth(CLIENT_ID, SECRET_KEY)
r = requests.post(base_url + 'api/v1/access_token',
                         data=data,
                         headers={'user-agent': 'tutorialAPI by user'},
                         auth=auth)
TOKEN = r.json()

{'access_token': '1604787663584-e7XujtCJ787654321dseUpSY1KUSow',
 'token_type': 'bearer',
 'expires_in': 3600,
 'scope': '*'}

I have been working on it but when it comes to making the upvote I do not know how to do it, as you have already seen,

I may not be doing the post submission well, because I haven’t found a way to do it.

A&E