# AnonRateThrottle in Django REST framework

**URL:** <https://forum.djangoproject.com/t/anonratethrottle-in-django-rest-framework/7311>\
**Category:** Using Django\
**Created:** [March 31, 2021, 7:36am UTC](https://forum.djangoproject.com/t/anonratethrottle-in-django-rest-framework/7311 "2021-03-31T07:36:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![valentinogagliardi](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/valentinogagliardi/32/607_2.png) [@valentinogagliardi](https://forum.djangoproject.com/u/valentinogagliardi)\
**Post date:** [March 31, 2021, 7:36am UTC](https://forum.djangoproject.com/t/anonratethrottle-in-django-rest-framework/7311/1 "2021-03-31T07:36:51Z")

</div>

Hi there! I’ve been experimenting with throttling in DRF, and I noticed that `rest_framework.throttling.AnonRateThrottle` does not work as I was expecting. Does this throttle class limit nonauthenticated users? The following configuration described in DRF docs does work well for authenticated users, but it does not rate limit anonymous users:

```python
REST_FRAMEWORK = {
    'DEFAULT_THROTTLE_CLASSES': [
        'rest_framework.throttling.AnonRateThrottle',
        'rest_framework.throttling.UserRateThrottle'
    ],
    'DEFAULT_THROTTLE_RATES': {
        'anon': '100/day',
        'user': '1000/day'
    }
}

```

Am I missing something? Thanks!

---

<div class="post-metadata">

**Author:** ![CodenameTim](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/codenametim/32/31507_2.png) [@CodenameTim](https://forum.djangoproject.com/u/CodenameTim)\
**Post date:** [March 31, 2021, 10:23pm UTC](https://forum.djangoproject.com/t/anonratethrottle-in-django-rest-framework/7311/2 "2021-03-31T22:23:54Z")

</div>

That looks correct to me. How are you testing this and what results are you seeing?

Take a look at the [DRF source code and how it generates the unique ID for the anonymous user](https://github.com/encode/django-rest-framework/blob/0323d6f8955f987771269506ca5da461e2e7a248/rest_framework/throttling.py#L23). It’s possible your test case is being considered unique anonymous users.
