This repository has been archived by the owner on Apr 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathproblem_details.py
65 lines (55 loc) · 1.85 KB
/
problem_details.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from .util.problem_detail import ProblemDetail as pd
from .util.http import INTEGRATION_ERROR
from flask_babel import lazy_gettext as _
# Generic problem detail documents that recapitulate HTTP errors.
# call detailed() to add more specific information.
INVALID_INPUT = pd(
"http://librarysimplified.org/terms/problem/invalid-input",
400,
_("Invalid input."),
_("You provided invalid or unrecognized input."),
)
INVALID_CREDENTIALS = pd(
"http://librarysimplified.org/terms/problem/credentials-invalid",
401,
_("Invalid credentials"),
_("Valid credentials are required."),
)
METHOD_NOT_ALLOWED = pd(
"http://librarysimplified.org/terms/problem/method-not-allowed",
405,
_("Method not allowed"),
_("The HTTP method you used is not allowed on this resource."),
)
UNSUPPORTED_MEDIA_TYPE = pd(
"http://librarysimplified.org/terms/problem/unsupported-media-type",
415,
_("Unsupported media type"),
_("You submitted an unsupported media type."),
)
PAYLOAD_TOO_LARGE = pd(
"http://librarysimplified.org/terms/problem/unsupported-media-type",
413,
_("Payload too large"),
_("You submitted a document that was too large."),
)
INTERNAL_SERVER_ERROR = pd(
"http://librarysimplified.org/terms/problem/internal-server-error",
500,
_("Internal server error."),
_("Internal server error"),
)
# Problem detail documents that are specific to the Library Simplified
# domain.
INVALID_URN = pd(
"http://librarysimplified.org/terms/problem/could-not-parse-urn",
400,
_("Invalid URN"),
_("Could not parse identifier."),
)
UNRECOGNIZED_DATA_SOURCE = pd(
"http://librarysimplified.org/terms/problem/unrecognized-data-source",
400,
_("Unrecognized data source."),
_("I don't know anything about that data source."),
)