how does posting with APIs work?

comments (single view)

I first want to get my auth token, how do I get that? POST or GET?

Python code:

import requests

import json

url = "https://api.wasteof.money/login"

body = {"username": "dea", "password": "ThisIsMyWorld"}

response = requests.post(url, json=body)

# Beautify the output result

print("Status Code:", response.status_code)

print("Headers:")

print(json.dumps(dict(response.headers), indent=2))

print("Response Body:")

print(json.dumps(response.json(), indent=2))

POST, also the URL for that is /session

perfectly working now, thanks!

no problem!

View all comments