prune_captcha 1.3.0__tar.gz → 1.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. prune_captcha-1.5.0/PKG-INFO +145 -0
  2. prune_captcha-1.5.0/README.md +127 -0
  3. prune_captcha-1.5.0/captcha_prune/__init__.py +1 -0
  4. prune_captcha-1.5.0/captcha_prune/apps.py +13 -0
  5. prune_captcha-1.5.0/captcha_prune/context_processors.py +12 -0
  6. {prune_captcha-1.3.0 → prune_captcha-1.5.0}/captcha_prune/models.py +3 -1
  7. prune_captcha-1.5.0/captcha_prune/utils.py +68 -0
  8. prune_captcha-1.5.0/prune_captcha.egg-info/PKG-INFO +145 -0
  9. {prune_captcha-1.3.0 → prune_captcha-1.5.0}/prune_captcha.egg-info/SOURCES.txt +4 -0
  10. {prune_captcha-1.3.0 → prune_captcha-1.5.0}/prune_captcha.egg-info/requires.txt +1 -0
  11. {prune_captcha-1.3.0 → prune_captcha-1.5.0}/pyproject.toml +2 -1
  12. prune_captcha-1.3.0/PKG-INFO +0 -77
  13. prune_captcha-1.3.0/README.md +0 -60
  14. prune_captcha-1.3.0/prune_captcha.egg-info/PKG-INFO +0 -77
  15. {prune_captcha-1.3.0 → prune_captcha-1.5.0}/captcha_prune/asgi.py +0 -0
  16. {prune_captcha-1.3.0/captcha_prune → prune_captcha-1.5.0/captcha_prune/components}/__init__.py +0 -0
  17. {prune_captcha-1.3.0 → prune_captcha-1.5.0}/captcha_prune/migrations/0001_initial.py +0 -0
  18. {prune_captcha-1.3.0 → prune_captcha-1.5.0}/captcha_prune/migrations/0002_remove_captcha_created_at_remove_captcha_pos_x_and_more.py +0 -0
  19. {prune_captcha-1.3.0 → prune_captcha-1.5.0}/captcha_prune/migrations/__init__.py +0 -0
  20. {prune_captcha-1.3.0 → prune_captcha-1.5.0}/captcha_prune/payloads.py +0 -0
  21. {prune_captcha-1.3.0 → prune_captcha-1.5.0}/captcha_prune/settings.py +0 -0
  22. {prune_captcha-1.3.0 → prune_captcha-1.5.0}/captcha_prune/urls.py +0 -0
  23. {prune_captcha-1.3.0 → prune_captcha-1.5.0}/captcha_prune/views.py +0 -0
  24. {prune_captcha-1.3.0 → prune_captcha-1.5.0}/captcha_prune/wsgi.py +0 -0
  25. {prune_captcha-1.3.0 → prune_captcha-1.5.0}/commons/base_model.py +0 -0
  26. {prune_captcha-1.3.0 → prune_captcha-1.5.0}/commons/decorators.py +0 -0
  27. {prune_captcha-1.3.0 → prune_captcha-1.5.0}/prune_captcha.egg-info/dependency_links.txt +0 -0
  28. {prune_captcha-1.3.0 → prune_captcha-1.5.0}/prune_captcha.egg-info/top_level.txt +0 -0
  29. {prune_captcha-1.3.0 → prune_captcha-1.5.0}/setup.cfg +0 -0
  30. {prune_captcha-1.3.0 → prune_captcha-1.5.0}/tests/__init__.py +0 -0
  31. {prune_captcha-1.3.0 → prune_captcha-1.5.0}/tests/captcha_prune/__init__.py +0 -0
  32. {prune_captcha-1.3.0 → prune_captcha-1.5.0}/tests/captcha_prune/test_views.py +0 -0
@@ -0,0 +1,145 @@
1
+ Metadata-Version: 2.4
2
+ Name: prune_captcha
3
+ Version: 1.5.0
4
+ Summary: A tool to protect formulaire from spam.
5
+ Author-email: Arnout <bastien@prune.sh>
6
+ Project-URL: Made_by, https://prune.sh/
7
+ Keywords: captcha,django,code-quality
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: <4.0,>=3.12
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: django>=5.2
14
+ Requires-Dist: psycopg2-binary>=2.9.10
15
+ Requires-Dist: pydantic>=2.11.4
16
+ Requires-Dist: pydantic-settings>=2.9.1
17
+ Requires-Dist: requests>=2.32.3
18
+
19
+ # Prune's Captcha
20
+
21
+ ## What is it for?
22
+
23
+ Captcha helps prevent robots from spamming using your forms.
24
+
25
+ ## Prerequisites
26
+
27
+ - To be installed on a Prune Django project that uses poetry or UV
28
+
29
+ ## UV project
30
+
31
+ ### Installation
32
+
33
+ Run the following command in the console:
34
+
35
+ ```bash
36
+ uv add captcha_prune
37
+ ```
38
+
39
+ ### Updating the captcha
40
+
41
+ Don't hesitate to regularly run `uv sync --upgrade`, as the captcha evolves with time and our practices!
42
+
43
+ ## Poetry project
44
+
45
+ ### Installation
46
+
47
+ Run the following command:
48
+
49
+ ```bash
50
+ poetry add prune_captcha
51
+ ```
52
+
53
+ ### Updating the captcha
54
+
55
+ Don't hesitate to regularly run `poetry update`, as the captcha evolves with time and our practices!
56
+
57
+ ## Captcha Integration
58
+
59
+ ### Configuration
60
+
61
+ In `settings.py`, set the path to the images used for the puzzle:
62
+
63
+ ```python
64
+ PUZZLE_IMAGE_STATIC_PATH = "website/images/"
65
+ ```
66
+
67
+ ### Utilisation
68
+
69
+ - GET request (form display)
70
+
71
+ - Use create_and_get_puzzle to generate the captcha data.
72
+
73
+ - Passes the data into the context under the puzzle variable.
74
+
75
+ - Include the component in your template:
76
+
77
+ ```python
78
+ from captcha_prune.utils import create_and_get_puzzle
79
+ ```
80
+
81
+ ```
82
+ {% include "captcha_prune/components/captcha.html" %}
83
+ ```
84
+
85
+ - POST request (form submission)
86
+
87
+ - Use verify_captcha to validate the captcha.
88
+
89
+ ```python
90
+ from captcha_prune.utils import verify_captcha
91
+ ```
92
+
93
+ ```python
94
+ verify_captcha(request, redirect("/"), redirect("website:contact-page"), form)
95
+ ```
96
+
97
+ - No feedback if the captcha is correct.
98
+
99
+ - Redirects in case of expired session or incorrect captcha.
100
+
101
+ ### Example
102
+
103
+ ```python
104
+ from django.shortcuts import render, redirect
105
+
106
+ from django.contrib import messages
107
+ from captcha_prune.utils import create_and_get_puzzle, verify_captcha
108
+ from .forms import ContactForm
109
+
110
+ def contact_view(request):
111
+ if request.method == "POST":
112
+ form = ContactForm(request.POST)
113
+ if form.is_valid():
114
+ verify_captcha(
115
+ request,
116
+ redirect("/"),
117
+ redirect("website:contact-page"),
118
+ form
119
+ )
120
+ messages.success(request, "Formulaire soumis avec succès.")
121
+ return redirect("/")
122
+ else:
123
+ puzzle = create_and_get_puzzle(request)
124
+ else:
125
+ form = ContactForm()
126
+ puzzle = create_and_get_puzzle(request)
127
+ return render(
128
+ request,
129
+ "website/pages/contact/page.html",
130
+ {"form": form, "puzzle": puzzle},
131
+ )
132
+
133
+ ```
134
+
135
+ # Available Versions
136
+
137
+ | Version | Date | Notes |
138
+ | ------- | ---------- | ---------------------------------- |
139
+ | 1.5.0 | 2025-05-20 | app config fixed, components ... |
140
+ | 1.4.0 | 2025-05-20 | added BaseModel in Captcha, ... |
141
+ | 1.3.0 | 2025-04-30 | deleted start_server, deleted ... |
142
+ | 1.2.0 | 2025-04-30 | fixed prune_captcha command, ... |
143
+ | 1.1.0 | 2025-04-30 | start_server was not a module, ... |
144
+ | 1.0.0 | 2025-04-29 | First version of the `captcha` ... |
145
+ ```
@@ -0,0 +1,127 @@
1
+ # Prune's Captcha
2
+
3
+ ## What is it for?
4
+
5
+ Captcha helps prevent robots from spamming using your forms.
6
+
7
+ ## Prerequisites
8
+
9
+ - To be installed on a Prune Django project that uses poetry or UV
10
+
11
+ ## UV project
12
+
13
+ ### Installation
14
+
15
+ Run the following command in the console:
16
+
17
+ ```bash
18
+ uv add captcha_prune
19
+ ```
20
+
21
+ ### Updating the captcha
22
+
23
+ Don't hesitate to regularly run `uv sync --upgrade`, as the captcha evolves with time and our practices!
24
+
25
+ ## Poetry project
26
+
27
+ ### Installation
28
+
29
+ Run the following command:
30
+
31
+ ```bash
32
+ poetry add prune_captcha
33
+ ```
34
+
35
+ ### Updating the captcha
36
+
37
+ Don't hesitate to regularly run `poetry update`, as the captcha evolves with time and our practices!
38
+
39
+ ## Captcha Integration
40
+
41
+ ### Configuration
42
+
43
+ In `settings.py`, set the path to the images used for the puzzle:
44
+
45
+ ```python
46
+ PUZZLE_IMAGE_STATIC_PATH = "website/images/"
47
+ ```
48
+
49
+ ### Utilisation
50
+
51
+ - GET request (form display)
52
+
53
+ - Use create_and_get_puzzle to generate the captcha data.
54
+
55
+ - Passes the data into the context under the puzzle variable.
56
+
57
+ - Include the component in your template:
58
+
59
+ ```python
60
+ from captcha_prune.utils import create_and_get_puzzle
61
+ ```
62
+
63
+ ```
64
+ {% include "captcha_prune/components/captcha.html" %}
65
+ ```
66
+
67
+ - POST request (form submission)
68
+
69
+ - Use verify_captcha to validate the captcha.
70
+
71
+ ```python
72
+ from captcha_prune.utils import verify_captcha
73
+ ```
74
+
75
+ ```python
76
+ verify_captcha(request, redirect("/"), redirect("website:contact-page"), form)
77
+ ```
78
+
79
+ - No feedback if the captcha is correct.
80
+
81
+ - Redirects in case of expired session or incorrect captcha.
82
+
83
+ ### Example
84
+
85
+ ```python
86
+ from django.shortcuts import render, redirect
87
+
88
+ from django.contrib import messages
89
+ from captcha_prune.utils import create_and_get_puzzle, verify_captcha
90
+ from .forms import ContactForm
91
+
92
+ def contact_view(request):
93
+ if request.method == "POST":
94
+ form = ContactForm(request.POST)
95
+ if form.is_valid():
96
+ verify_captcha(
97
+ request,
98
+ redirect("/"),
99
+ redirect("website:contact-page"),
100
+ form
101
+ )
102
+ messages.success(request, "Formulaire soumis avec succès.")
103
+ return redirect("/")
104
+ else:
105
+ puzzle = create_and_get_puzzle(request)
106
+ else:
107
+ form = ContactForm()
108
+ puzzle = create_and_get_puzzle(request)
109
+ return render(
110
+ request,
111
+ "website/pages/contact/page.html",
112
+ {"form": form, "puzzle": puzzle},
113
+ )
114
+
115
+ ```
116
+
117
+ # Available Versions
118
+
119
+ | Version | Date | Notes |
120
+ | ------- | ---------- | ---------------------------------- |
121
+ | 1.5.0 | 2025-05-20 | app config fixed, components ... |
122
+ | 1.4.0 | 2025-05-20 | added BaseModel in Captcha, ... |
123
+ | 1.3.0 | 2025-04-30 | deleted start_server, deleted ... |
124
+ | 1.2.0 | 2025-04-30 | fixed prune_captcha command, ... |
125
+ | 1.1.0 | 2025-04-30 | start_server was not a module, ... |
126
+ | 1.0.0 | 2025-04-29 | First version of the `captcha` ... |
127
+ ```
@@ -0,0 +1 @@
1
+ default_app_config = "captcha_prune.apps.DjangoPuzzleConfig"
@@ -0,0 +1,13 @@
1
+ from django.apps import AppConfig
2
+ from django.conf import settings
3
+ from django.core.exceptions import ImproperlyConfigured
4
+
5
+
6
+ class DjangoPuzzleConfig(AppConfig):
7
+ name = "captcha_prune"
8
+
9
+ def ready(self):
10
+ if not hasattr(settings, "PUZZLE_IMAGE_STATIC_PATH"):
11
+ raise ImproperlyConfigured(
12
+ "django-puzzle: vous devez définir PUZZLE_IMAGE_STATIC_PATH dans settings.py"
13
+ )
@@ -0,0 +1,12 @@
1
+ from django.conf import settings
2
+ from django.core.exceptions import ImproperlyConfigured
3
+
4
+
5
+ def puzzle_static_path(request):
6
+ try:
7
+ path = settings.PUZZLE_IMAGE_STATIC_PATH
8
+ except AttributeError:
9
+ raise ImproperlyConfigured(
10
+ "Vous devez définir PUZZLE_IMAGE_STATIC_PATH dans votre settings.py"
11
+ )
12
+ return {"PUZZLE_IMAGE_STATIC_PATH": path}
@@ -3,8 +3,10 @@ import uuid
3
3
 
4
4
  from django.db import models
5
5
 
6
+ from commons.base_model import BaseModel
6
7
 
7
- class Captcha(models.Model):
8
+
9
+ class Captcha(BaseModel):
8
10
  uuid = models.UUIDField(default=uuid.uuid4, unique=True)
9
11
  width = models.IntegerField(default=350)
10
12
  height = models.IntegerField(default=200)
@@ -0,0 +1,68 @@
1
+ import os
2
+ import random
3
+ from urllib.parse import urlencode
4
+
5
+ import requests
6
+ from django.conf import settings
7
+ from django.contrib import messages
8
+ from django.http import HttpRequest, HttpResponse
9
+ from django.urls import reverse
10
+
11
+
12
+ def create_and_get_puzzle(request: HttpRequest) -> HttpResponse | dict:
13
+ puzzle_path = getattr(settings, "PUZZLE_IMAGE_STATIC_PATH", None)
14
+ try:
15
+ response = requests.post(
16
+ request.build_absolute_uri(reverse("captcha:create-captcha"))
17
+ ).json()
18
+ except requests.RequestException:
19
+ return HttpResponse(status=502)
20
+ request.session["puzzle_uuid"] = response["uuid"]
21
+ puzzle_images = [
22
+ f
23
+ for f in os.listdir(puzzle_path)
24
+ if f.lower().endswith((".jpg", ".jpeg", ".png", ".gif"))
25
+ ]
26
+ selected_image = random.choice(puzzle_images)
27
+ return {
28
+ "uuid": response["uuid"],
29
+ "width": response["width"],
30
+ "height": response["height"],
31
+ "piece_width": response["piece_width"],
32
+ "piece_height": response["piece_height"],
33
+ "pos_x_solution": response["pos_x_solution"],
34
+ "pos_y_solution": response["pos_y_solution"],
35
+ "piece_pos_x": response["piece_pos_x"],
36
+ "piece_pos_y": response["piece_pos_y"],
37
+ "image": selected_image,
38
+ }
39
+
40
+
41
+ def verify_captcha(
42
+ request: HttpRequest,
43
+ session_expired: HttpResponse,
44
+ incorrect_captcha: HttpResponse,
45
+ form,
46
+ ) -> HttpResponse | None:
47
+ puzzle_uuid = request.session.get("puzzle_uuid")
48
+ if not puzzle_uuid:
49
+ messages.error(request, "La session a expiré.")
50
+ return session_expired
51
+ try:
52
+ base_url = request.build_absolute_uri(
53
+ reverse("captcha:verify-captcha", kwargs={"uuid": puzzle_uuid}),
54
+ )
55
+ data = {
56
+ "pos_x_answer": request.POST.get("pos_x_answer"),
57
+ "pos_y_answer": request.POST.get("pos_y_answer"),
58
+ }
59
+ query_string = urlencode(data)
60
+ full_url = f"{base_url}?{query_string}"
61
+ response = requests.get(full_url)
62
+ if response.status_code == 401:
63
+ messages.error(request, "Captcha incorrect. Veuillez réessayer.")
64
+ return incorrect_captcha
65
+ del form.fields["pos_x_answer"]
66
+ del form.fields["pos_y_answer"]
67
+ except requests.RequestException:
68
+ return HttpResponse(status=502)
@@ -0,0 +1,145 @@
1
+ Metadata-Version: 2.4
2
+ Name: prune_captcha
3
+ Version: 1.5.0
4
+ Summary: A tool to protect formulaire from spam.
5
+ Author-email: Arnout <bastien@prune.sh>
6
+ Project-URL: Made_by, https://prune.sh/
7
+ Keywords: captcha,django,code-quality
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: <4.0,>=3.12
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: django>=5.2
14
+ Requires-Dist: psycopg2-binary>=2.9.10
15
+ Requires-Dist: pydantic>=2.11.4
16
+ Requires-Dist: pydantic-settings>=2.9.1
17
+ Requires-Dist: requests>=2.32.3
18
+
19
+ # Prune's Captcha
20
+
21
+ ## What is it for?
22
+
23
+ Captcha helps prevent robots from spamming using your forms.
24
+
25
+ ## Prerequisites
26
+
27
+ - To be installed on a Prune Django project that uses poetry or UV
28
+
29
+ ## UV project
30
+
31
+ ### Installation
32
+
33
+ Run the following command in the console:
34
+
35
+ ```bash
36
+ uv add captcha_prune
37
+ ```
38
+
39
+ ### Updating the captcha
40
+
41
+ Don't hesitate to regularly run `uv sync --upgrade`, as the captcha evolves with time and our practices!
42
+
43
+ ## Poetry project
44
+
45
+ ### Installation
46
+
47
+ Run the following command:
48
+
49
+ ```bash
50
+ poetry add prune_captcha
51
+ ```
52
+
53
+ ### Updating the captcha
54
+
55
+ Don't hesitate to regularly run `poetry update`, as the captcha evolves with time and our practices!
56
+
57
+ ## Captcha Integration
58
+
59
+ ### Configuration
60
+
61
+ In `settings.py`, set the path to the images used for the puzzle:
62
+
63
+ ```python
64
+ PUZZLE_IMAGE_STATIC_PATH = "website/images/"
65
+ ```
66
+
67
+ ### Utilisation
68
+
69
+ - GET request (form display)
70
+
71
+ - Use create_and_get_puzzle to generate the captcha data.
72
+
73
+ - Passes the data into the context under the puzzle variable.
74
+
75
+ - Include the component in your template:
76
+
77
+ ```python
78
+ from captcha_prune.utils import create_and_get_puzzle
79
+ ```
80
+
81
+ ```
82
+ {% include "captcha_prune/components/captcha.html" %}
83
+ ```
84
+
85
+ - POST request (form submission)
86
+
87
+ - Use verify_captcha to validate the captcha.
88
+
89
+ ```python
90
+ from captcha_prune.utils import verify_captcha
91
+ ```
92
+
93
+ ```python
94
+ verify_captcha(request, redirect("/"), redirect("website:contact-page"), form)
95
+ ```
96
+
97
+ - No feedback if the captcha is correct.
98
+
99
+ - Redirects in case of expired session or incorrect captcha.
100
+
101
+ ### Example
102
+
103
+ ```python
104
+ from django.shortcuts import render, redirect
105
+
106
+ from django.contrib import messages
107
+ from captcha_prune.utils import create_and_get_puzzle, verify_captcha
108
+ from .forms import ContactForm
109
+
110
+ def contact_view(request):
111
+ if request.method == "POST":
112
+ form = ContactForm(request.POST)
113
+ if form.is_valid():
114
+ verify_captcha(
115
+ request,
116
+ redirect("/"),
117
+ redirect("website:contact-page"),
118
+ form
119
+ )
120
+ messages.success(request, "Formulaire soumis avec succès.")
121
+ return redirect("/")
122
+ else:
123
+ puzzle = create_and_get_puzzle(request)
124
+ else:
125
+ form = ContactForm()
126
+ puzzle = create_and_get_puzzle(request)
127
+ return render(
128
+ request,
129
+ "website/pages/contact/page.html",
130
+ {"form": form, "puzzle": puzzle},
131
+ )
132
+
133
+ ```
134
+
135
+ # Available Versions
136
+
137
+ | Version | Date | Notes |
138
+ | ------- | ---------- | ---------------------------------- |
139
+ | 1.5.0 | 2025-05-20 | app config fixed, components ... |
140
+ | 1.4.0 | 2025-05-20 | added BaseModel in Captcha, ... |
141
+ | 1.3.0 | 2025-04-30 | deleted start_server, deleted ... |
142
+ | 1.2.0 | 2025-04-30 | fixed prune_captcha command, ... |
143
+ | 1.1.0 | 2025-04-30 | start_server was not a module, ... |
144
+ | 1.0.0 | 2025-04-29 | First version of the `captcha` ... |
145
+ ```
@@ -1,13 +1,17 @@
1
1
  README.md
2
2
  pyproject.toml
3
3
  captcha_prune/__init__.py
4
+ captcha_prune/apps.py
4
5
  captcha_prune/asgi.py
6
+ captcha_prune/context_processors.py
5
7
  captcha_prune/models.py
6
8
  captcha_prune/payloads.py
7
9
  captcha_prune/settings.py
8
10
  captcha_prune/urls.py
11
+ captcha_prune/utils.py
9
12
  captcha_prune/views.py
10
13
  captcha_prune/wsgi.py
14
+ captcha_prune/components/__init__.py
11
15
  captcha_prune/migrations/0001_initial.py
12
16
  captcha_prune/migrations/0002_remove_captcha_created_at_remove_captcha_pos_x_and_more.py
13
17
  captcha_prune/migrations/__init__.py
@@ -2,3 +2,4 @@ django>=5.2
2
2
  psycopg2-binary>=2.9.10
3
3
  pydantic>=2.11.4
4
4
  pydantic-settings>=2.9.1
5
+ requests>=2.32.3
@@ -20,7 +20,7 @@ classifiers = [
20
20
  keywords = ["captcha", "django", "code-quality"]
21
21
  urls = {Made_by = "https://prune.sh/"}
22
22
  name = "prune_captcha"
23
- version = "1.3.0"
23
+ version = "1.5.0"
24
24
  description = "A tool to protect formulaire from spam."
25
25
  readme = "README.md"
26
26
  dependencies = [
@@ -28,4 +28,5 @@ dependencies = [
28
28
  "psycopg2-binary>=2.9.10",
29
29
  "pydantic>=2.11.4",
30
30
  "pydantic-settings>=2.9.1",
31
+ "requests>=2.32.3",
31
32
  ]
@@ -1,77 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: prune_captcha
3
- Version: 1.3.0
4
- Summary: A tool to protect formulaire from spam.
5
- Author-email: Arnout <bastien@prune.sh>
6
- Project-URL: Made_by, https://prune.sh/
7
- Keywords: captcha,django,code-quality
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Operating System :: OS Independent
11
- Requires-Python: <4.0,>=3.12
12
- Description-Content-Type: text/markdown
13
- Requires-Dist: django>=5.2
14
- Requires-Dist: psycopg2-binary>=2.9.10
15
- Requires-Dist: pydantic>=2.11.4
16
- Requires-Dist: pydantic-settings>=2.9.1
17
-
18
- # Prune's Captcha
19
-
20
- ## What is it for?
21
-
22
- Captcha helps prevent robots from spamming using your forms.
23
-
24
- ## Prerequisites
25
-
26
- - To be installed on a Prune Django project that uses poetry or UV
27
-
28
- ## UV project
29
-
30
- ### Installation
31
-
32
- Run the following command in the console:
33
-
34
- ```bash
35
- uv add captcha_prune
36
- ```
37
-
38
- ### Updating the captcha
39
-
40
- Don't hesitate to regularly run `uv sync --upgrade`, as the captcha evolves with time and our practices!
41
-
42
- ## Poetry project
43
-
44
- ### Installation
45
-
46
- Run the following command:
47
-
48
- ```bash
49
- poetry add prune_captcha
50
- ```
51
-
52
- ### Updating the captcha
53
-
54
- Don't hesitate to regularly run `poetry update`, as the captcha evolves with time and our practices!
55
-
56
- ## Captcha Integration
57
-
58
- Once the project is launched, the application's URLs need to be linked to the form.
59
-
60
- - When making a **GET** request to the form page, the API must be called via the **creation endpoint**. The response will contain the necessary information to display the captcha.
61
- - When submitting the form via **POST**, the API must be called via the **verification endpoint**. The response will indicate whether the captcha is valid or not.
62
-
63
- ## Captcha Display
64
-
65
- To display the captcha correctly, use the data received in the response from the creation request. This data includes:
66
-
67
- - the captcha's width and height,
68
- - the piece's width and height,
69
- - the current position of the piece,
70
- - the target position (where the piece should be placed),
71
- - the expected precision (captcha difficulty level).
72
-
73
- # Available Versions
74
-
75
- | Version | Date | Notes |
76
- | ------- | ---------- | -------------------------------------- |
77
- | 1.0.0 | 2025-03-14 | First version of the `captcha` package |
@@ -1,60 +0,0 @@
1
- # Prune's Captcha
2
-
3
- ## What is it for?
4
-
5
- Captcha helps prevent robots from spamming using your forms.
6
-
7
- ## Prerequisites
8
-
9
- - To be installed on a Prune Django project that uses poetry or UV
10
-
11
- ## UV project
12
-
13
- ### Installation
14
-
15
- Run the following command in the console:
16
-
17
- ```bash
18
- uv add captcha_prune
19
- ```
20
-
21
- ### Updating the captcha
22
-
23
- Don't hesitate to regularly run `uv sync --upgrade`, as the captcha evolves with time and our practices!
24
-
25
- ## Poetry project
26
-
27
- ### Installation
28
-
29
- Run the following command:
30
-
31
- ```bash
32
- poetry add prune_captcha
33
- ```
34
-
35
- ### Updating the captcha
36
-
37
- Don't hesitate to regularly run `poetry update`, as the captcha evolves with time and our practices!
38
-
39
- ## Captcha Integration
40
-
41
- Once the project is launched, the application's URLs need to be linked to the form.
42
-
43
- - When making a **GET** request to the form page, the API must be called via the **creation endpoint**. The response will contain the necessary information to display the captcha.
44
- - When submitting the form via **POST**, the API must be called via the **verification endpoint**. The response will indicate whether the captcha is valid or not.
45
-
46
- ## Captcha Display
47
-
48
- To display the captcha correctly, use the data received in the response from the creation request. This data includes:
49
-
50
- - the captcha's width and height,
51
- - the piece's width and height,
52
- - the current position of the piece,
53
- - the target position (where the piece should be placed),
54
- - the expected precision (captcha difficulty level).
55
-
56
- # Available Versions
57
-
58
- | Version | Date | Notes |
59
- | ------- | ---------- | -------------------------------------- |
60
- | 1.0.0 | 2025-03-14 | First version of the `captcha` package |
@@ -1,77 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: prune_captcha
3
- Version: 1.3.0
4
- Summary: A tool to protect formulaire from spam.
5
- Author-email: Arnout <bastien@prune.sh>
6
- Project-URL: Made_by, https://prune.sh/
7
- Keywords: captcha,django,code-quality
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Operating System :: OS Independent
11
- Requires-Python: <4.0,>=3.12
12
- Description-Content-Type: text/markdown
13
- Requires-Dist: django>=5.2
14
- Requires-Dist: psycopg2-binary>=2.9.10
15
- Requires-Dist: pydantic>=2.11.4
16
- Requires-Dist: pydantic-settings>=2.9.1
17
-
18
- # Prune's Captcha
19
-
20
- ## What is it for?
21
-
22
- Captcha helps prevent robots from spamming using your forms.
23
-
24
- ## Prerequisites
25
-
26
- - To be installed on a Prune Django project that uses poetry or UV
27
-
28
- ## UV project
29
-
30
- ### Installation
31
-
32
- Run the following command in the console:
33
-
34
- ```bash
35
- uv add captcha_prune
36
- ```
37
-
38
- ### Updating the captcha
39
-
40
- Don't hesitate to regularly run `uv sync --upgrade`, as the captcha evolves with time and our practices!
41
-
42
- ## Poetry project
43
-
44
- ### Installation
45
-
46
- Run the following command:
47
-
48
- ```bash
49
- poetry add prune_captcha
50
- ```
51
-
52
- ### Updating the captcha
53
-
54
- Don't hesitate to regularly run `poetry update`, as the captcha evolves with time and our practices!
55
-
56
- ## Captcha Integration
57
-
58
- Once the project is launched, the application's URLs need to be linked to the form.
59
-
60
- - When making a **GET** request to the form page, the API must be called via the **creation endpoint**. The response will contain the necessary information to display the captcha.
61
- - When submitting the form via **POST**, the API must be called via the **verification endpoint**. The response will indicate whether the captcha is valid or not.
62
-
63
- ## Captcha Display
64
-
65
- To display the captcha correctly, use the data received in the response from the creation request. This data includes:
66
-
67
- - the captcha's width and height,
68
- - the piece's width and height,
69
- - the current position of the piece,
70
- - the target position (where the piece should be placed),
71
- - the expected precision (captcha difficulty level).
72
-
73
- # Available Versions
74
-
75
- | Version | Date | Notes |
76
- | ------- | ---------- | -------------------------------------- |
77
- | 1.0.0 | 2025-03-14 | First version of the `captcha` package |
File without changes