-
Notifications
You must be signed in to change notification settings - Fork 5
Requests and Responses
The Canvas SDK relies heavily upon the Requests library for making REST calls to the Canvas API. A user of the library doesn't have to know how the Requests library works (although it may be beneficial), but should be familiar with what the library returns as a Response. Also, many of the optional request parameters that can be passed to the resource functions are a subset of the Requests library's optional parameters.
All SDK methods return a requests.Response object by default. There are a number of attributes and methods that are exposed on the Response object, including the HTTP status code and whether the request performed a redirect, but the primary interaction a caller will be performing is to call the "json" method of a response. This is due to the fact that all of the Canvas API calls return JSON responses, and the .json() method will yield that data.