![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
django-rest-recaptcha
Advanced tools
Django rest recaptcha field for easy integration of google recaptcha with django-rest-framework.
Django Rest reCAPTCHA field to add google recaptcha in django-rest-framework
Tested with:
#. Install with pip install django-rest-recaptcha
.
#. Add 'recaptcha'
to your INSTALLED_APPS
setting.
#. Register and obtain recaptcha keys here https://www.google.com/recaptcha/admin
#. Add the obtained keys to settings(For testing and development you can leave it blank to use
default test keys as mentioned here https://developers.google.com/recaptcha/docs/faq
).
For example:
.. code-block:: python
GR_CAPTCHA_SECRET_KEY = 'GoogleRecaptchaPrivateKey001'
#. Now you can import and use the recaptcha field in your serializer. For example:
.. code-block:: python
from rest_framework import serializers
from recaptcha.fields import ReCaptchaField
class ExampleSerializer(serializers.Serializer):
recaptcha = ReCaptchaField(write_only=True)
...
Unit Testing
Django Rest reCAPTCHA uses an environment variable ``RECAPTCHA_TESTING`` which
helps tests. This environment variable should be set to ``"True"`` in your
testing environment and any value will be considered to be validated.
Example:
.. code-block:: python
import os
os.environ['RECAPTCHA_TESTING'] = 'True'
data = {'recaptcha': 'dummy value'}
response = client.post('/my/api/endpoint/', data)
assert response.status_code == 200
The code above may vary according to your testing suite.
FAQs
Django rest recaptcha field for easy integration of google recaptcha with django-rest-framework.
We found that django-rest-recaptcha demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.