docs: Apply suggestions from code review

Typos and other small fixes.

Co-authored-by: Robert Raposa <rraposa@edx.org>
This commit is contained in:
Feanil Patel
2023-08-18 10:14:02 -04:00
committed by GitHub
parent df5759ca37
commit 73001b1a59
2 changed files with 4 additions and 5 deletions

View File

@@ -3,7 +3,7 @@ How To Use the REST API
.. How-tos should have a short introduction sentence that captures the user's goal and introduces the steps.
This how-to will help get setup to be able to make aunthenticated requests to
This how-to will help you get setup to be able to make authenticated requests to
the edx-platform REST API.
Assumptions
@@ -44,7 +44,7 @@ Steps
#. Save the ``client_id`` and ``client_secret``.
#. The best way to interact with the edx-platform REST API is by making
requests using the JWT Authorization header. User the ``client_id`` and
requests using the JWT Authorization header. Use the ``client_id`` and
``client_secret`` to get a JWT token.
.. code-block:: python
@@ -53,7 +53,7 @@ Steps
import requests
client_id = "vovj0AItd9EnrOKjkDli0HpSF9HoooaTY9yueafn"
# Client secretes should not be exposed in your code, we put it here to
# Client secrets should not be exposed in your code, we put it here to
# make the example more clear.
client_secret = "a3Fkwr24dfDSlIXt3v3q4Ob41CYQNZyGmtK8Y8ax0srpIa2vJON3OC5Rvj1i1wizsIUv1W1qM1Q2XPeuyjucNixsHXZsuw1dn2B9nH3IyjSvuFb5KoydDvWX8Hx8znqD"

View File

@@ -54,14 +54,13 @@ Get a JWT with a client_id and client_secret
from pprint import pprint
client_id = "ukbclQB8aPh7hgsy8ifPXkPf7fRqgUq1w21f2YZa"
# Note this should actually be secert and probably not in your code but
# Note this should actually be secret and probably not in your code but
# provided here in the example
client_secret = "xkN0BJ19q9Jk8UPUppEtC1xe4764c81ioFtlegvokbmnAC7CFCT5gG1Og5nnFmCNc3NHNhUwWWDRVcBfnLSZ4xAlEmSePzfkFtLE06cwR1MuSc0gx9LUEjRrTs3j2vgK"
credential = f"{client_id}:{client_secret}"
encoded_credential = base64.b64encode(credential.encode("utf-8")).decode("utf-8")
headers = {"Authorization": f"Basic {encoded_credential}", "Cache-Control": "no-cache"}
data = {"grant_type": "client_credentials", "token_type": "jwt"}