http-scots 0.1.0__py3-none-any.whl
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.
- http_scots/__init__.py +8 -0
- http_scots/http.py +417 -0
- http_scots/py.typed +0 -0
- http_scots-0.1.0.dist-info/METADATA +143 -0
- http_scots-0.1.0.dist-info/RECORD +7 -0
- http_scots-0.1.0.dist-info/WHEEL +4 -0
- http_scots-0.1.0.dist-info/licenses/LICENSE +21 -0
http_scots/__init__.py
ADDED
http_scots/http.py
ADDED
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
"""The Scots HTTPMethod and HTTPStatus enums."""
|
|
2
|
+
|
|
3
|
+
from enum import IntEnum, StrEnum
|
|
4
|
+
|
|
5
|
+
__all__ = ["HTTPMethod", "HTTPStatus"]
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class HTTPStatus(IntEnum):
|
|
9
|
+
"""HTTP status codes and reason phrases
|
|
10
|
+
|
|
11
|
+
Status codes from the following RFCs are all observed:
|
|
12
|
+
|
|
13
|
+
* RFC 9110: HTTP Semantics, obsoletes 7231, which obsoleted 2616
|
|
14
|
+
* RFC 6585: Additional HTTP Status Codes
|
|
15
|
+
* RFC 3229: Delta encoding in HTTP
|
|
16
|
+
* RFC 4918: HTTP Extensions for WebDAV, obsoletes 2518
|
|
17
|
+
* RFC 5842: Binding Extensions to WebDAV
|
|
18
|
+
* RFC 7238: Permanent Redirect
|
|
19
|
+
* RFC 2295: Transparent Content Negotiation in HTTP
|
|
20
|
+
* RFC 2774: An HTTP Extension Framework
|
|
21
|
+
* RFC 7725: An HTTP Status Code to Report Legal Obstacles
|
|
22
|
+
* RFC 7540: Hypertext Transfer Protocol Version 2 (HTTP/2)
|
|
23
|
+
* RFC 2324: Hyper Text Coffee Pot Control Protocol (HTCPCP/1.0)
|
|
24
|
+
* RFC 8297: An HTTP Status Code for Indicating Hints
|
|
25
|
+
* RFC 8470: Using Early Data in HTTP
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
def __new__(cls, value, phrase, description=""):
|
|
29
|
+
obj = int.__new__(cls, value)
|
|
30
|
+
obj._value_ = value
|
|
31
|
+
obj.phrase = phrase # type: ignore[attr-defined]
|
|
32
|
+
obj.description = description # type: ignore[attr-defined]
|
|
33
|
+
return obj
|
|
34
|
+
|
|
35
|
+
@property
|
|
36
|
+
def is_informational(self):
|
|
37
|
+
return 100 <= self <= 199
|
|
38
|
+
|
|
39
|
+
@property
|
|
40
|
+
def is_success(self):
|
|
41
|
+
return 200 <= self <= 299
|
|
42
|
+
|
|
43
|
+
@property
|
|
44
|
+
def is_redirection(self):
|
|
45
|
+
return 300 <= self <= 399
|
|
46
|
+
|
|
47
|
+
@property
|
|
48
|
+
def is_client_error(self):
|
|
49
|
+
return 400 <= self <= 499
|
|
50
|
+
|
|
51
|
+
@property
|
|
52
|
+
def is_server_error(self):
|
|
53
|
+
return 500 <= self <= 599
|
|
54
|
+
|
|
55
|
+
# informational
|
|
56
|
+
AYE_ON_YE_GO = (
|
|
57
|
+
100,
|
|
58
|
+
"Aye on ye go",
|
|
59
|
+
"Awright, ah've goat it, keep gaun, big man.",
|
|
60
|
+
)
|
|
61
|
+
RIGHT_WERE_SWAPPIN = (
|
|
62
|
+
101,
|
|
63
|
+
"Right were swappin",
|
|
64
|
+
"Right, we're daein it a DIFFERENT wey noo, dae whit the Upgrade heider says, ya bam.",
|
|
65
|
+
)
|
|
66
|
+
AYE_HAUD_ON = (
|
|
67
|
+
102,
|
|
68
|
+
"Aye haud on",
|
|
69
|
+
"Haud yer horses, am still workin' oan it.",
|
|
70
|
+
)
|
|
71
|
+
HERES_A_WEE_CLUE = (
|
|
72
|
+
103,
|
|
73
|
+
"Heres a wee clue",
|
|
74
|
+
"Here's a wee heads-up afore the main even', hen.",
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
# success
|
|
78
|
+
NAE_BOTHER = (
|
|
79
|
+
200,
|
|
80
|
+
"Nae bother",
|
|
81
|
+
"There ye go, sorted, here's yer paper.",
|
|
82
|
+
)
|
|
83
|
+
THATS_IT_MADE = (
|
|
84
|
+
201,
|
|
85
|
+
"Thats it made",
|
|
86
|
+
"Made yer new ting, the URL's in the Location heider, there ye go.",
|
|
87
|
+
)
|
|
88
|
+
AYE_AHLL_SEE_TAE_IT = (
|
|
89
|
+
202,
|
|
90
|
+
"Aye ahll see tae it",
|
|
91
|
+
"Aye awright, ah'll get tae it... eventually. Doon the line, like.",
|
|
92
|
+
)
|
|
93
|
+
DINNAE_QUOTE_ME = (
|
|
94
|
+
203,
|
|
95
|
+
"Dinnae quote me",
|
|
96
|
+
"This is second-hand, tae, but it'll dae.",
|
|
97
|
+
)
|
|
98
|
+
HEHAW = (
|
|
99
|
+
204,
|
|
100
|
+
"Hehaw",
|
|
101
|
+
"Done. Sent ye nothin' back, get tae fuck... ah mean, aw done, nothin' tae send.",
|
|
102
|
+
)
|
|
103
|
+
CLEAR_THAT_AFF_AN_START_AGAIN = (
|
|
104
|
+
205,
|
|
105
|
+
"Clear that aff an start again",
|
|
106
|
+
"Wipe that, start again, ya muppet.",
|
|
107
|
+
)
|
|
108
|
+
HERES_A_WEE_BIT = (
|
|
109
|
+
206,
|
|
110
|
+
"Heres a wee bit",
|
|
111
|
+
"Here's a wee bit oh it, no the hale ting.",
|
|
112
|
+
)
|
|
113
|
+
BIT_O_THIS_BIT_O_THAT = (
|
|
114
|
+
207,
|
|
115
|
+
"Bit o this bit o that",
|
|
116
|
+
"Awright there's aboot ten dif'rent answers in the hale pile, am no gonnae list them aw here.",
|
|
117
|
+
)
|
|
118
|
+
AH_TELT_YE_AWREADY_YA_WEE_SCUNNER = (
|
|
119
|
+
208,
|
|
120
|
+
"Ah telt ye awready ya wee scunner",
|
|
121
|
+
"Awready telt ye this, ya deaf basturt.",
|
|
122
|
+
)
|
|
123
|
+
HERES_WHITS_CHANGED = (
|
|
124
|
+
226,
|
|
125
|
+
"Heres whits changed",
|
|
126
|
+
"Did it wi' a wee bit oh fancy dif patchin'.",
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
# redirection
|
|
130
|
+
TAKE_YER_PICK = (
|
|
131
|
+
300,
|
|
132
|
+
"Take yer pick",
|
|
133
|
+
"There's aboot five dif'rent tings there, pit yer back intae it an' pick wan.",
|
|
134
|
+
)
|
|
135
|
+
WEVE_FLITTED = (
|
|
136
|
+
301,
|
|
137
|
+
"Weve flitted",
|
|
138
|
+
"It's AWAY. Fur good. Follaw the new address, ya roaster.",
|
|
139
|
+
)
|
|
140
|
+
WERE_OWER_THERE_THE_NOO = (
|
|
141
|
+
302,
|
|
142
|
+
"Were ower there the noo",
|
|
143
|
+
"It's owa the road just noo, gae look there.",
|
|
144
|
+
)
|
|
145
|
+
ASK_HIM_OWER_THERE = (
|
|
146
|
+
303,
|
|
147
|
+
"Ask him ower there",
|
|
148
|
+
"Dinnae GET it here, gae look ower there, pal.",
|
|
149
|
+
)
|
|
150
|
+
SAME_AULD_SHITE = (
|
|
151
|
+
304,
|
|
152
|
+
"Same auld shite",
|
|
153
|
+
"Same as last time, take it fae yer cache an' quit whingin'.",
|
|
154
|
+
)
|
|
155
|
+
GO_THROUGH_HIM = (
|
|
156
|
+
305,
|
|
157
|
+
"Go through him",
|
|
158
|
+
"Ye GO THROUGH the middleman, nae arguins.",
|
|
159
|
+
)
|
|
160
|
+
FUCK_OFF_OWER_THERE_FOR_NOO = (
|
|
161
|
+
307,
|
|
162
|
+
"Fuck off ower there for noo",
|
|
163
|
+
"It's doon the road just noo, back efter, dae the same as ye did.",
|
|
164
|
+
)
|
|
165
|
+
FUCK_OFF_OWER_THERE_FOR_GUID = (
|
|
166
|
+
308,
|
|
167
|
+
"Fuck off ower there for guid",
|
|
168
|
+
"Same as 301 but haud the method, ya learned it noo.",
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
# client error
|
|
172
|
+
WHIT_THE_FUCKS_THIS = (
|
|
173
|
+
400,
|
|
174
|
+
"Whit the fucks this",
|
|
175
|
+
"Whit in the name oh the wee man am sure ye sent me? Pure pish, that.",
|
|
176
|
+
)
|
|
177
|
+
WHO_THE_FUCK_ARE_YOU = (
|
|
178
|
+
401,
|
|
179
|
+
"Who the fuck are you",
|
|
180
|
+
"Wha the hell ur you? Show me yer papers, hen.",
|
|
181
|
+
)
|
|
182
|
+
GIES_YER_MONEY = (
|
|
183
|
+
402,
|
|
184
|
+
"Gies yer money",
|
|
185
|
+
"Cash up front, big man, nae pleckin' creddit.",
|
|
186
|
+
)
|
|
187
|
+
GET_TAE_FUCK = (
|
|
188
|
+
403,
|
|
189
|
+
"Get tae fuck",
|
|
190
|
+
"Naw. An' nae amount oh beggin's gonnae change ma mind, so it isnae.",
|
|
191
|
+
)
|
|
192
|
+
NO_FUCKIN_HERE_PAL = (
|
|
193
|
+
404,
|
|
194
|
+
"No fuckin here pal",
|
|
195
|
+
"Aint got a scooby, pal. Naebody here by that name.",
|
|
196
|
+
)
|
|
197
|
+
YE_CANNAE_DAE_THAT = (
|
|
198
|
+
405,
|
|
199
|
+
"Ye cannae dae that",
|
|
200
|
+
"Ye cannae dae THAT tae this, ya fanny.",
|
|
201
|
+
)
|
|
202
|
+
WEVE_NANE_O_THAT_KIND = (
|
|
203
|
+
406,
|
|
204
|
+
"Weve nane o that kind",
|
|
205
|
+
"Nah, no in that format, am no a beggar.",
|
|
206
|
+
)
|
|
207
|
+
AN_WHOS_YER_PAL = (
|
|
208
|
+
407,
|
|
209
|
+
"An whos yer pal",
|
|
210
|
+
"The middleman wants tae ken wha you ur first.",
|
|
211
|
+
)
|
|
212
|
+
AHVE_BEEN_STAUNIN_HERE_AGES = (
|
|
213
|
+
408,
|
|
214
|
+
"Ahve been staunin here ages",
|
|
215
|
+
"Too slow, hen. Ah gave up oan ye. Try again.",
|
|
216
|
+
)
|
|
217
|
+
PICK_A_FUCKIN_LANE = (
|
|
218
|
+
409,
|
|
219
|
+
"Pick a fuckin lane",
|
|
220
|
+
"Ye cannae dae that, it'll batter intae somethin' else, ya numpty.",
|
|
221
|
+
)
|
|
222
|
+
DEID_AN_BURIED = (
|
|
223
|
+
410,
|
|
224
|
+
"Deid an buried",
|
|
225
|
+
"It's deid, buried, gone. Quit lookin'.",
|
|
226
|
+
)
|
|
227
|
+
HOW_LANG_IS_IT_THEN = (
|
|
228
|
+
411,
|
|
229
|
+
"How lang is it then",
|
|
230
|
+
"Hoo big is this ting? Tell me, ah'm no a mind reader.",
|
|
231
|
+
)
|
|
232
|
+
THATS_NO_WHIT_WE_AGREED = (
|
|
233
|
+
412,
|
|
234
|
+
"Thats no whit we agreed",
|
|
235
|
+
"Ye said it'd be x first, it's no, so get tae.",
|
|
236
|
+
)
|
|
237
|
+
THATS_FUCKIN_MASSIVE = (
|
|
238
|
+
413,
|
|
239
|
+
"Thats fuckin massive",
|
|
240
|
+
"That's pure muckle, mate. Dinnae shove that here.",
|
|
241
|
+
)
|
|
242
|
+
AHM_NO_READIN_ALL_THAT = (
|
|
243
|
+
414,
|
|
244
|
+
"Ahm no readin all that",
|
|
245
|
+
"That URL's longer than a Glesga scheme, naw.",
|
|
246
|
+
)
|
|
247
|
+
NAE_IDEA_WHIT_THAT_IS = (
|
|
248
|
+
415,
|
|
249
|
+
"Nae idea whit that is",
|
|
250
|
+
"Am no dealin' wi' that format, ya troglodyte.",
|
|
251
|
+
)
|
|
252
|
+
IT_DISNAE_GO_THAT_FAR = (
|
|
253
|
+
416,
|
|
254
|
+
"It disnae go that far",
|
|
255
|
+
"Ye asked fur bits that dinnae even EXIST. Away.",
|
|
256
|
+
)
|
|
257
|
+
AYE_YE_WISH = (
|
|
258
|
+
417,
|
|
259
|
+
"Aye ye wish",
|
|
260
|
+
"Ye expected too much, hen. Disappointed.",
|
|
261
|
+
)
|
|
262
|
+
AHM_A_FUCKIN_TEAPOT = (
|
|
263
|
+
418,
|
|
264
|
+
"Ahm a fuckin teapot",
|
|
265
|
+
"Am a FUKIN TEAPOT, pal. Nae coffee. Away an' boil yer ain kettle.",
|
|
266
|
+
)
|
|
267
|
+
WRONG_CUNT = (
|
|
268
|
+
421,
|
|
269
|
+
"Wrong cunt",
|
|
270
|
+
"That's no fur me, pal. Gae the right server.",
|
|
271
|
+
)
|
|
272
|
+
AH_KEN_WHIT_YE_MEAN_BUT_NAW = (
|
|
273
|
+
422,
|
|
274
|
+
"Ah ken whit ye mean but naw",
|
|
275
|
+
"Ah can read it, but it's utter mince, cannae dae anythin' wi' it.",
|
|
276
|
+
)
|
|
277
|
+
ITS_SNIBBED = (
|
|
278
|
+
423,
|
|
279
|
+
"Its snibbed",
|
|
280
|
+
"Naw, it's locked. Somecunt else's got the key.",
|
|
281
|
+
)
|
|
282
|
+
THE_LAST_WAN_WENT_TITS_UP = (
|
|
283
|
+
424,
|
|
284
|
+
"The last wan went tits up",
|
|
285
|
+
"The bit afore it went tae shit, so this did an' aw.",
|
|
286
|
+
)
|
|
287
|
+
HAUD_YER_HORSES = (
|
|
288
|
+
425,
|
|
289
|
+
"Haud yer horses",
|
|
290
|
+
"Naw, too soon, somecunt could replay that. Dinnae be so keen.",
|
|
291
|
+
)
|
|
292
|
+
GET_YERSEL_A_NEW_WAN = (
|
|
293
|
+
426,
|
|
294
|
+
"Get yersel a new wan",
|
|
295
|
+
"Naw, that auld way? Get wit' the times, upgrade, ya fossil.",
|
|
296
|
+
)
|
|
297
|
+
CHECK_FIRST_YA_CHANCER = (
|
|
298
|
+
428,
|
|
299
|
+
"Check first ya chancer",
|
|
300
|
+
"Put a condition on it first, ya cowboy, or am no touchin' it.",
|
|
301
|
+
)
|
|
302
|
+
SLOW_DOON = (
|
|
303
|
+
429,
|
|
304
|
+
"Slow doon",
|
|
305
|
+
"ALRIGHT. PACK IT IN. Ye've asked aboot a thoosand times. Haud on. Wait yer turn, ya greedy basturt.",
|
|
306
|
+
)
|
|
307
|
+
TOO_MUCH_PISH = (
|
|
308
|
+
431,
|
|
309
|
+
"Too much pish",
|
|
310
|
+
"Yur heiders are pure massive, mate. Trim it doon an' come back.",
|
|
311
|
+
)
|
|
312
|
+
AWAY_YE_CLATTY_WEE_BASTARD = (
|
|
313
|
+
451,
|
|
314
|
+
"Away ye clatty wee bastard",
|
|
315
|
+
"The polis/the lawmental telt me tae take that doon. Naethin' tae dae wi' me, pal.",
|
|
316
|
+
)
|
|
317
|
+
|
|
318
|
+
# server errors
|
|
319
|
+
THE_COUNCIL_SAYS_NAW = (
|
|
320
|
+
500,
|
|
321
|
+
"The council says naw",
|
|
322
|
+
"Hell's teeth, ah've gone an' buggered it masel. Am pure scundered.",
|
|
323
|
+
)
|
|
324
|
+
AHVE_FUCKED_IT = (
|
|
325
|
+
501,
|
|
326
|
+
"Ahve fucked it",
|
|
327
|
+
"Naebody taught me how tae dae that. Sorries, pal, I literally cannae.",
|
|
328
|
+
)
|
|
329
|
+
AH_DINNAE_DAE_THAT = (
|
|
330
|
+
502,
|
|
331
|
+
"Ah dinnae dae that",
|
|
332
|
+
"The server ah passed it tae came back wi' pure garbage. Incompetent like.",
|
|
333
|
+
)
|
|
334
|
+
THE_OTHER_BAMPOTS_BROKEN = (
|
|
335
|
+
503,
|
|
336
|
+
"The other bampots broken",
|
|
337
|
+
"Am snowed under, hen. Too many o' yis at once. Come back efter.",
|
|
338
|
+
)
|
|
339
|
+
WERE_FUCKIN_SHUT = (
|
|
340
|
+
504,
|
|
341
|
+
"Were fuckin shut",
|
|
342
|
+
"Ah asked the ither server an' it's just sittin' there like a dummy. Nae answer. Gave up.",
|
|
343
|
+
)
|
|
344
|
+
THE_BASTARDS_NO_ANSWERIN = (
|
|
345
|
+
505,
|
|
346
|
+
"The bastards no answerin",
|
|
347
|
+
"That version? Nah. We dinnae dae that auld pish here.",
|
|
348
|
+
)
|
|
349
|
+
WHIT_FUCKIN_CENTURY_ARE_YE_IN = (
|
|
350
|
+
506,
|
|
351
|
+
"Whit fuckin century are ye in",
|
|
352
|
+
"Config's a pure bombscare, am arguin' wi' masel. Get an admin.",
|
|
353
|
+
)
|
|
354
|
+
AHM_STAPPIT_FU = (
|
|
355
|
+
507,
|
|
356
|
+
"Ahm stappit fu",
|
|
357
|
+
"Am full up, ya animal. Nowheres tae pit any mair oh yer stuff.",
|
|
358
|
+
)
|
|
359
|
+
ROUND_AN_ROUND_YA_DAFT_TWAT = (
|
|
360
|
+
508,
|
|
361
|
+
"Round an round ya daft twat",
|
|
362
|
+
"Ah've went roon in a circle aboot a hunner times. Nipped that in the bud.",
|
|
363
|
+
)
|
|
364
|
+
YELL_NEED_MAIR_THAN_THAT = (
|
|
365
|
+
510,
|
|
366
|
+
"Yell need mair than that",
|
|
367
|
+
"Cannae do that wi'oot ye tellin' me the extra bit. Yer policy, no mine.",
|
|
368
|
+
)
|
|
369
|
+
LOG_IN_TAE_THE_WIFI_PAL = (
|
|
370
|
+
511,
|
|
371
|
+
"Log in tae the wifi pal",
|
|
372
|
+
"Ye need tae sign in tae the wifi first, hen. Nae subscription, nae internet.",
|
|
373
|
+
)
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
class HTTPMethod(StrEnum):
|
|
377
|
+
"""HTTP methods and descriptions
|
|
378
|
+
|
|
379
|
+
Methods from the following RFCs are all observed:
|
|
380
|
+
|
|
381
|
+
* RFC 9110: HTTP Semantics, obsoletes 7231, which obsoleted 2616
|
|
382
|
+
* RFC 5789: PATCH Method for HTTP
|
|
383
|
+
"""
|
|
384
|
+
|
|
385
|
+
def __new__(cls, value, description):
|
|
386
|
+
obj = str.__new__(cls, value)
|
|
387
|
+
obj._value_ = value
|
|
388
|
+
obj.description = description # type: ignore[attr-defined]
|
|
389
|
+
return obj
|
|
390
|
+
|
|
391
|
+
def __repr__(self):
|
|
392
|
+
return f"<{self.__class__.__name__}.{self._name_}>"
|
|
393
|
+
|
|
394
|
+
NIP_IN = "CONNECT", "Let's get the door open tae the server, pal, ah'm comin' in."
|
|
395
|
+
SKIP_IT = "DELETE", "Richt, that's goin' in the skip. Dinnae come lookin' fur it."
|
|
396
|
+
GIES = "GET", "Get me that thing ower there, hen, ah'll no touch it."
|
|
397
|
+
JUST_OOTER = (
|
|
398
|
+
"HEAD",
|
|
399
|
+
"Same as gie's that, but just the label an' the top line. Dinnae bother wi' the body.",
|
|
400
|
+
)
|
|
401
|
+
WHITS_MA_OPTS = (
|
|
402
|
+
"OPTIONS",
|
|
403
|
+
"Gie's a wee list o' whit ye can actually dae here, pal, afore ah embarrass masel.",
|
|
404
|
+
)
|
|
405
|
+
DOABIN = "PATCH", "Just dab a bit here an' there, dinnae rip the hale thing apart."
|
|
406
|
+
HAWDES = (
|
|
407
|
+
"POST",
|
|
408
|
+
"Right, take this bag o' stuff an' dae yer thing wi' it, pal. Yer business, no mine.",
|
|
409
|
+
)
|
|
410
|
+
AWAWI = (
|
|
411
|
+
"PUT",
|
|
412
|
+
"Right, bin the auld yin, this is it noo. The hale replacemint, nae arguin'.",
|
|
413
|
+
)
|
|
414
|
+
ECHAECHO = (
|
|
415
|
+
"TRACE",
|
|
416
|
+
"Right, pass this alang the line an' send it back, ah want tae see wha's been snoopin' oan it.",
|
|
417
|
+
)
|
http_scots/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: http-scots
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: HTTP methods and status codes, but in Scots. Not safe for work, nor for polite company.
|
|
5
|
+
Keywords: http,status-codes,scots,scottish,enum,humour,nsfw
|
|
6
|
+
Author: Baptiste Darthenay
|
|
7
|
+
Author-email: Baptiste Darthenay <baptiste.darthenay@gmail.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Natural Language :: English
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Project-URL: Homepage, https://github.com/blfpd/http-scots
|
|
25
|
+
Project-URL: Repository, https://github.com/blfpd/http-scots
|
|
26
|
+
Project-URL: Issues, https://github.com/blfpd/http-scots/issues
|
|
27
|
+
Project-URL: Changelog, https://github.com/blfpd/http-scots/blob/main/CHANGELOG.md
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# http-scots
|
|
31
|
+
|
|
32
|
+
[](https://github.com/blfpd/http-scots/actions/workflows/ci.yaml)
|
|
33
|
+
[](https://pypi.org/project/http-scots/)
|
|
34
|
+
[](https://pypi.org/project/http-scots/)
|
|
35
|
+
[](LICENSE)
|
|
36
|
+
|
|
37
|
+
HTTP methods and status codes, translated into Scots. It is a drop-in sibling of
|
|
38
|
+
the standard library's `http.HTTPStatus` and `http.HTTPMethod`, except every
|
|
39
|
+
status has opinions.
|
|
40
|
+
|
|
41
|
+
> **Content warning:** this package contains strong language, and quite a lot of
|
|
42
|
+
> it. If your logs are read aloud in stand-up, or your compliance team has a
|
|
43
|
+
> sense of humour deficit, maybe stick with `http`.
|
|
44
|
+
|
|
45
|
+
## Why
|
|
46
|
+
|
|
47
|
+
Because `404 Not Found` is polite, and `404 No fuckin here pal` is accurate.
|
|
48
|
+
|
|
49
|
+
Also because a well-typed enum is a perfectly good vehicle for a joke, and
|
|
50
|
+
because someone, somewhere, will put `HTTPStatus.GET_TAE_FUCK` in a demo and
|
|
51
|
+
not realise their client is watching.
|
|
52
|
+
|
|
53
|
+
## Credit where it is due
|
|
54
|
+
|
|
55
|
+
This package was totally inspired by
|
|
56
|
+
[HTTP status codes in Scots](https://underwood.network/http/scots.html) on
|
|
57
|
+
underwood.network. Go and have a look at the original, it is very funny.
|
|
58
|
+
|
|
59
|
+
## Install
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
pip install http-scots
|
|
63
|
+
# or
|
|
64
|
+
uv add http-scots
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Needs Python 3.11 or newer (we lean on `StrEnum`, and we are not sorry).
|
|
68
|
+
|
|
69
|
+
## Usage
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from http_scots import HTTPMethod, HTTPStatus
|
|
73
|
+
# or, if you like it explicit: from http_scots.http import HTTPMethod, HTTPStatus
|
|
74
|
+
|
|
75
|
+
HTTPStatus(404)
|
|
76
|
+
# <HTTPStatus.NO_FUCKIN_HERE_PAL: 404>
|
|
77
|
+
|
|
78
|
+
HTTPStatus.NAE_BOTHER == 200
|
|
79
|
+
# True, it is a real IntEnum, so it compares like one
|
|
80
|
+
|
|
81
|
+
HTTPStatus.AHM_A_FUCKIN_TEAPOT.phrase
|
|
82
|
+
# 'Ahm a fuckin teapot'
|
|
83
|
+
|
|
84
|
+
HTTPStatus.SLOW_DOON.description
|
|
85
|
+
# 'ALRIGHT. PACK IT IN. Ye've asked aboot a thoosand times. ...'
|
|
86
|
+
|
|
87
|
+
HTTPStatus.THE_COUNCIL_SAYS_NAW.is_server_error
|
|
88
|
+
# True
|
|
89
|
+
|
|
90
|
+
HTTPMethod.GIES == "GET"
|
|
91
|
+
# True, it is a real StrEnum too
|
|
92
|
+
|
|
93
|
+
HTTPMethod.SKIP_IT.description
|
|
94
|
+
# "Richt, that's goin' in the skip. Dinnae come lookin' fur it."
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Every member carries a `phrase` (the reason phrase) and a `description` (what
|
|
98
|
+
the server is actually thinking). Status codes also come with the usual
|
|
99
|
+
`is_informational`, `is_success`, `is_redirection`, `is_client_error` and
|
|
100
|
+
`is_server_error` helpers.
|
|
101
|
+
|
|
102
|
+
## A small sample
|
|
103
|
+
|
|
104
|
+
| Code | Standard name | Scots |
|
|
105
|
+
| ---- | --------------------- | ----------------------------------- |
|
|
106
|
+
| 200 | OK | `NAE_BOTHER` |
|
|
107
|
+
| 301 | Moved Permanently | `WEVE_FLITTED` |
|
|
108
|
+
| 403 | Forbidden | `GET_TAE_FUCK` |
|
|
109
|
+
| 418 | I'm a teapot | `AHM_A_FUCKIN_TEAPOT` |
|
|
110
|
+
| 429 | Too Many Requests | `SLOW_DOON` |
|
|
111
|
+
| 500 | Internal Server Error | `THE_COUNCIL_SAYS_NAW` |
|
|
112
|
+
|
|
113
|
+
| Method | Scots |
|
|
114
|
+
| ------ | ------------ |
|
|
115
|
+
| GET | `GIES` |
|
|
116
|
+
| POST | `HAWDES` |
|
|
117
|
+
| PUT | `AWAWI` |
|
|
118
|
+
| DELETE | `SKIP_IT` |
|
|
119
|
+
|
|
120
|
+
The full list lives in [`src/http_scots/http.py`](src/http_scots/http.py).
|
|
121
|
+
|
|
122
|
+
## Is it serious?
|
|
123
|
+
|
|
124
|
+
The code is. It is typed (`py.typed` ships in the wheel), tested, has no
|
|
125
|
+
runtime dependencies, and follows the same RFCs as the standard library. The
|
|
126
|
+
translations are not serious, and are not an authoritative guide to the Scots
|
|
127
|
+
language. Spelling is deliberately loose and phonetic. If you are a Scots
|
|
128
|
+
speaker with better ideas, please open an issue, we would love the help.
|
|
129
|
+
|
|
130
|
+
## Development
|
|
131
|
+
|
|
132
|
+
```sh
|
|
133
|
+
uv sync
|
|
134
|
+
uv run pytest
|
|
135
|
+
uv build
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for the details, including how releases
|
|
139
|
+
are cut.
|
|
140
|
+
|
|
141
|
+
## Licence
|
|
142
|
+
|
|
143
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
http_scots/__init__.py,sha256=w60YW5SV7L24U5L3ksi0othG2FeEddNOh2hhn_-WKNg,207
|
|
2
|
+
http_scots/http.py,sha256=0J63WpvIJohBc1L3bNyrgIhjmVmeTZiax0WxR05ML1Y,12322
|
|
3
|
+
http_scots/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
http_scots-0.1.0.dist-info/licenses/LICENSE,sha256=1qDoNUBJXDKMCS59dsOjFMA6ipBLffbgwRsuNaYdur4,1075
|
|
5
|
+
http_scots-0.1.0.dist-info/WHEEL,sha256=G_-rrEibZr7OEM7zdH1dSO6s-VdjfnS5PA4CLAdI9Vw,80
|
|
6
|
+
http_scots-0.1.0.dist-info/METADATA,sha256=sc4pa3KY5SF-JYlqKrUYNxM4aMDPirvkqOqMGRisH50,5080
|
|
7
|
+
http_scots-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Baptiste Darthenay
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|