og @og

how do I log in with a python script?

Nov 30, 2022, 8:01 PM
10
View all Parent

comments

Highlighted comment

Does that mean im logged in on the script now?

no, you need to provide the token returned as an Authorization header in future requests

Can you give an example?

// js
fetch(`https://api.wasteof.money`, { headers: { Authorization: <TOKEN>}})

this is untested but should work:

requests.post("https://api.wasteof.money", headers={ Authorization: <TOKEN> })

this will make a post:

import requests

authJson = {"Authorization": "my token"}

post = requests.post("https://api.wasteof.money/posts", headers = authJson, json = {"post": "api test"})

or to get your token:

import requests
requests.get("https://wasteof.money/session", json={"username": "user", "password": "password"})