-
-
Save parzibyte/0d7307ec61b81e06587bf2cbd32d2cca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://parzibyte.me/blog | |
import requests | |
url = "https://jsonplaceholder.typicode.com/posts" | |
usuario = { | |
"title": "Título", | |
"body": "El cuerpo", | |
} | |
respuesta = requests.post(url, json=usuario) | |
# Ahora decodificamos la respuesta como json | |
como_json = respuesta.json() | |
print("La respuesta del servidor es:") | |
print(como_json) | |
# Podemos acceder al id por ejemplo | |
id = como_json["id"] | |
print(f"El id es: {id}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment