how do I log in with a python script?
send { username, password } to https://api.wasteof.money/session to get a token
https://api.wasteof.money/session
in a post request
tysm
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
Authorization
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"})
send { username, password } to
https://api.wasteof.money/sessionto get a tokenin a post request
tysm
Does that mean im logged in on the script now?
no, you need to provide the token returned as an
Authorizationheader in future requestsCan you give an example?
this is untested but should work:
this will make a post:
or to get your token: