Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
- Craig Thompson [@craigdsthompson](https://github.com/craigdsthompson)
- Dalton Durst [@UniversalSuperBox](https://github.com/UniversalSuperBox)
- Damian Sweeney [@damianfs](https://github.com/damianfs)
- Daniel Bosk [@dbosk](https://github.com/dbosk)
- Daniel Brinkman [@DanBrink91](https://github.com/DanBrink91)
- Daniel Grobani [@dgrobani](https://github.com/dgrobani)
- Daniel Molares [@dmols](https://github.com/dmols)
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### General

- Updated `RateLimitExceeded` exception to trigger on HTTP 429 instead of old 403.
- Add a default User-Agent header

## [3.4.0] - 2025-11-10

Expand Down
7 changes: 6 additions & 1 deletion canvasapi/requester.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def request(
_url=None,
_kwargs=None,
json=False,
**kwargs
**kwargs,
):
"""
Make a request to the Canvas API and return the response.
Expand Down Expand Up @@ -167,6 +167,8 @@ def request(
:type json: `bool`
:rtype: :class:`requests.Response`
"""
from canvasapi import __version__

# Check for specific URL endpoints available from Canvas. If not
# specified, pass the given URL and move on.
if not _url:
Expand All @@ -185,6 +187,9 @@ def request(
auth_header = {"Authorization": "Bearer {}".format(self.access_token)}
headers.update(auth_header)

if "User-Agent" not in headers:
headers["User-Agent"] = f"python-canvasapi/{__version__}"

# Convert kwargs into list of 2-tuples and combine with _kwargs.
_kwargs = _kwargs or []
_kwargs.extend(kwargs.items())
Expand Down