mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-17 03:51:03 +03:00
Make code snippet Python 3 compatible (#6377)
This commit is contained in:
parent
1e2fd25f54
commit
7749e4e3be
|
@ -197,7 +197,7 @@ If we're interacting with the API programmatically we need to explicitly provide
|
||||||
|
|
||||||
If we try to create a snippet without authenticating, we'll get an error:
|
If we try to create a snippet without authenticating, we'll get an error:
|
||||||
|
|
||||||
http POST http://127.0.0.1:8000/snippets/ code="print 123"
|
http POST http://127.0.0.1:8000/snippets/ code="print(123)"
|
||||||
|
|
||||||
{
|
{
|
||||||
"detail": "Authentication credentials were not provided."
|
"detail": "Authentication credentials were not provided."
|
||||||
|
@ -205,13 +205,13 @@ If we try to create a snippet without authenticating, we'll get an error:
|
||||||
|
|
||||||
We can make a successful request by including the username and password of one of the users we created earlier.
|
We can make a successful request by including the username and password of one of the users we created earlier.
|
||||||
|
|
||||||
http -a admin:password123 POST http://127.0.0.1:8000/snippets/ code="print 789"
|
http -a admin:password123 POST http://127.0.0.1:8000/snippets/ code="print(789)"
|
||||||
|
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"owner": "admin",
|
"owner": "admin",
|
||||||
"title": "foo",
|
"title": "foo",
|
||||||
"code": "print 789",
|
"code": "print(789)",
|
||||||
"linenos": false,
|
"linenos": false,
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"style": "friendly"
|
"style": "friendly"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user