dothttp-req 0.0.44a36__tar.gz → 0.0.44a37__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 (53) hide show
  1. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/PKG-INFO +28 -7
  2. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/README.md +22 -0
  3. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dothttp/http.tx +10 -0
  4. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dothttp/models/computed.py +2 -0
  5. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dothttp/models/parse_models.py +8 -1
  6. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dothttp/parse/__init__.py +9 -2
  7. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dothttp/parse/request_base.py +19 -3
  8. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/pyproject.toml +8 -7
  9. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/LICENSE.txt +0 -0
  10. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dotextensions/__init__.py +0 -0
  11. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dotextensions/server/__init__.py +0 -0
  12. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dotextensions/server/__main__.py +0 -0
  13. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dotextensions/server/agent.py +0 -0
  14. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dotextensions/server/handlers/__init__.py +0 -0
  15. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dotextensions/server/handlers/basic_handlers.py +0 -0
  16. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dotextensions/server/handlers/fs_handlers.py +0 -0
  17. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dotextensions/server/handlers/gohandler.py +0 -0
  18. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dotextensions/server/handlers/har2httphandler.py +0 -0
  19. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dotextensions/server/handlers/http2har.py +0 -0
  20. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dotextensions/server/handlers/http2postman.py +0 -0
  21. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dotextensions/server/handlers/postman2http.py +0 -0
  22. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dotextensions/server/models/__init__.py +0 -0
  23. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dotextensions/server/models/har.py +0 -0
  24. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dotextensions/server/postman/__init__.py +0 -0
  25. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dotextensions/server/postman2_1/__init__.py +0 -0
  26. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dotextensions/server/server.py +0 -0
  27. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dotextensions/server/utils.py +0 -0
  28. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dotextensions/version/__init__.py +0 -0
  29. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dotextensions/version/__main__.py +0 -0
  30. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dothttp/__init__.py +0 -0
  31. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dothttp/__main__.py +0 -0
  32. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dothttp/__version__.py +0 -0
  33. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dothttp/auth/__init__.py +0 -0
  34. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dothttp/auth/azure_auth.py +0 -0
  35. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dothttp/exceptions.py +0 -0
  36. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dothttp/models/__init__.py +0 -0
  37. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dothttp/parse/dsl_jsonparser.py +0 -0
  38. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dothttp/parse/expression.py +0 -0
  39. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dothttp/postScript.js +0 -0
  40. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dothttp/property_schema.py +0 -0
  41. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dothttp/script/__init__.py +0 -0
  42. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dothttp/script/js3py.py +0 -0
  43. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dothttp/utils/__init__.py +0 -0
  44. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dothttp/utils/common.py +0 -0
  45. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dothttp/utils/constants.py +0 -0
  46. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dothttp/utils/curl_utils.py +0 -0
  47. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dothttp/utils/json_utils.py +0 -0
  48. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dothttp/utils/log_utils.py +0 -0
  49. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dothttp/utils/property_util.py +0 -0
  50. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dothttp_test/__init__.py +0 -0
  51. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dothttp_test/__main__.py +0 -0
  52. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dothttp_test/conftest.py +0 -0
  53. {dothttp_req-0.0.44a36 → dothttp_req-0.0.44a37}/dothttp_test/dothttp_test.py +0 -0
@@ -1,26 +1,24 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dothttp-req
3
- Version: 0.0.44a36
3
+ Version: 0.0.44a37
4
4
  Summary: Dothttp is Simple http client for testing and development
5
5
  License: MIT
6
6
  License-File: LICENSE.txt
7
7
  Author: Prasanth
8
8
  Author-email: kesavarapu.siva@gmail.com
9
- Requires-Python: >=3.10,<3.15
9
+ Requires-Python: >=3.12,<3.15
10
10
  Classifier: License :: OSI Approved :: MIT License
11
11
  Classifier: Operating System :: OS Independent
12
12
  Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3.10
14
- Classifier: Programming Language :: Python :: 3.11
15
13
  Classifier: Programming Language :: Python :: 3.12
16
14
  Classifier: Programming Language :: Python :: 3.13
17
15
  Classifier: Programming Language :: Python :: 3.14
18
- Requires-Dist: cryptography (==50.0.0)
16
+ Requires-Dist: cryptography (==50.0.1)
19
17
  Requires-Dist: faker (==40.21.0)
20
18
  Requires-Dist: idna (==3.18)
21
19
  Requires-Dist: jsonschema (==4.26.0)
22
20
  Requires-Dist: jstyleson (==0.0.2)
23
- Requires-Dist: msal (==1.37.0)
21
+ Requires-Dist: msal (==1.38.0)
24
22
  Requires-Dist: parsys-requests-unixsocket (==0.3.2)
25
23
  Requires-Dist: pyyaml (==6.0.3)
26
24
  Requires-Dist: requests (==2.34.2)
@@ -28,9 +26,10 @@ Requires-Dist: requests-aws4auth (==1.3.2)
28
26
  Requires-Dist: requests-hawk (==1.2.1)
29
27
  Requires-Dist: requests-ntlm (==1.3.0)
30
28
  Requires-Dist: requests-pkcs12 (==1.27)
31
- Requires-Dist: restrictedpython (==8.4)
29
+ Requires-Dist: restrictedpython (==8.5)
32
30
  Requires-Dist: textx (==4.2.3)
33
31
  Requires-Dist: toml (==0.10.2)
32
+ Requires-Dist: truststore (==0.10.4)
34
33
  Requires-Dist: urllib3 (==2.7.0)
35
34
  Requires-Dist: xmltodict (>=1.0.2,<2.0.0)
36
35
  Project-URL: Bug Tracker, https://github.com/cedric05/dothttp
@@ -473,6 +472,28 @@ applied automatically — the agent never had to know or copy those details.
473
472
  relative to the working directory the command is run from, so this works
474
473
  best when the agent runs from the project root.
475
474
 
475
+ #### Custom and system trusted CAs
476
+
477
+ Client certificates and trusted server CAs are configured separately. Use
478
+ `trust(...)` to provide one CA certificate bundle for server verification:
479
+
480
+ ```http
481
+ @name("internal api")
482
+ GET https://api.example.com
483
+ trust("/path/to/internal-root-ca.pem")
484
+ ```
485
+
486
+ Trusted CA settings are inherited by child requests, as shown in
487
+ [`examples/trust_store.http`](./examples/trust_store.http). Requests fail
488
+ normally when the server is not trusted; `@insecure` is still the explicit
489
+ way to disable certificate verification.
490
+
491
+ ```http
492
+ @name("system trust store")
493
+ @enable_trust_store
494
+ GET https://api.example.com
495
+ ```
496
+
476
497
  -----------
477
498
  ### Vscode alternatives
478
499
 
@@ -435,6 +435,28 @@ applied automatically — the agent never had to know or copy those details.
435
435
  relative to the working directory the command is run from, so this works
436
436
  best when the agent runs from the project root.
437
437
 
438
+ #### Custom and system trusted CAs
439
+
440
+ Client certificates and trusted server CAs are configured separately. Use
441
+ `trust(...)` to provide one CA certificate bundle for server verification:
442
+
443
+ ```http
444
+ @name("internal api")
445
+ GET https://api.example.com
446
+ trust("/path/to/internal-root-ca.pem")
447
+ ```
448
+
449
+ Trusted CA settings are inherited by child requests, as shown in
450
+ [`examples/trust_store.http`](./examples/trust_store.http). Requests fail
451
+ normally when the server is not trusted; `@insecure` is still the explicit
452
+ way to disable certificate verification.
453
+
454
+ ```http
455
+ @name("system trust store")
456
+ @enable_trust_store
457
+ GET https://api.example.com
458
+ ```
459
+
438
460
  -----------
439
461
  ### Vscode alternatives
440
462
 
@@ -29,6 +29,7 @@ HTTP:
29
29
  urlwrap=URL
30
30
  (authwrap=AUTHWRAP)?
31
31
  (certificate = CERTAUTH)?
32
+ (trust = TRUSTAUTH)?
32
33
  (timeout=TIMEOUT)?
33
34
  (retry=RETRY)?
34
35
  (proxy=PROXY)?
@@ -81,6 +82,10 @@ CERTAUTH:
81
82
  )
82
83
  ;
83
84
 
85
+ TRUSTAUTH:
86
+ ('trust' | 'trustroot' | 'trustedca') '(' root=DotString ')'
87
+ ;
88
+
84
89
  HAWKAUTH:
85
90
  'hawkauth' '(' id=DotString ',' key = DotString (',' algorithm=DotString)? ')'
86
91
  ;
@@ -159,6 +164,7 @@ EXTRA_ARG:
159
164
  clear=CLEAR_SESSION
160
165
  | insecure=INSECURE
161
166
  | no_parent_script=CLEAR_PARENT_SCRIPT
167
+ | enable_trust_store=ENABLE_TRUST_STORE
162
168
  ;
163
169
 
164
170
  NAMED_ARG:
@@ -178,6 +184,10 @@ INSECURE:
178
184
  "@insecure"
179
185
  ;
180
186
 
187
+ ENABLE_TRUST_STORE:
188
+ "@enable_trust_store"
189
+ ;
190
+
181
191
  METHODTYPE:
182
192
  "GET" | "POST" | "OPTIONS"
183
193
  | "DELETE" | "CONNECT" | "PUT"
@@ -81,8 +81,10 @@ class HttpDef:
81
81
  payload: Optional[Payload] = None
82
82
  certificate: Optional[List[str]] = None
83
83
  p12: Optional[List[str]] = None
84
+ trust_root: Optional[str] = None
84
85
  output: str = None
85
86
  allow_insecure = False
87
+ enable_trust_store = False
86
88
  session_clear = False
87
89
  no_parent_script = False
88
90
  test_script: str = ""
@@ -214,7 +214,7 @@ class TestScript:
214
214
 
215
215
  @dataclass
216
216
  class Certificate:
217
- cert: str
217
+ cert: Optional[str]
218
218
  key: Optional[str]
219
219
 
220
220
 
@@ -224,6 +224,11 @@ class P12Certificate:
224
224
  password: Optional[str] = None
225
225
 
226
226
 
227
+ @dataclass
228
+ class Trust:
229
+ root: str
230
+
231
+
227
232
  @dataclass
228
233
  class ExtraArg:
229
234
  # clears session after each
@@ -232,6 +237,7 @@ class ExtraArg:
232
237
  insecure: Optional[str] = ""
233
238
  # ignore parent script
234
239
  no_parent_script: Optional[str] = ""
240
+ enable_trust_store: Optional[str] = ""
235
241
 
236
242
 
237
243
  @dataclass
@@ -249,6 +255,7 @@ class Http:
249
255
  lines: Optional[List[Line]]
250
256
  payload: Optional[Payload]
251
257
  output: Optional[ToFile]
258
+ trust: Optional[Trust] = None
252
259
  timeout: Optional[Timeout] = None
253
260
  retry: Optional[Retry] = None
254
261
  proxy: Optional[Proxy] = None
@@ -44,6 +44,7 @@ from ..models.parse_models import (
44
44
  P12Certificate,
45
45
  ScriptType,
46
46
  TestScript,
47
+ Trust,
47
48
  )
48
49
  from ..property_schema import property_schema
49
50
  from ..script import ScriptExecutionPython
@@ -556,7 +557,7 @@ class HttpDefBase(BaseModelProcessor):
556
557
  "certificate"
557
558
  )
558
559
  if certificate:
559
- if certificate.cert:
560
+ if hasattr(certificate, "cert") and certificate.cert:
560
561
  self.httpdef.certificate = [
561
562
  self.get_updated_content(certificate.cert),
562
563
  (
@@ -565,12 +566,16 @@ class HttpDefBase(BaseModelProcessor):
565
566
  else None
566
567
  ),
567
568
  ]
568
- elif certificate.p12_file:
569
+ elif hasattr(certificate, "p12_file") and certificate.p12_file:
569
570
  self.httpdef.p12 = [
570
571
  self.get_updated_content(certificate.p12_file),
571
572
  self.get_updated_content(certificate.password),
572
573
  ]
573
574
 
575
+ trust = self.get_current_or_base("trust")
576
+ if trust:
577
+ self.httpdef.trust_root = self.get_updated_content(trust.root)
578
+
574
579
  def load_extra_flags(self):
575
580
  # flags are extendable
576
581
  # once its marked as allow insecure
@@ -586,6 +591,8 @@ class HttpDefBase(BaseModelProcessor):
586
591
  self.httpdef.session_clear = True
587
592
  elif flag.insecure:
588
593
  self.httpdef.allow_insecure = True
594
+ elif flag.enable_trust_store:
595
+ self.httpdef.enable_trust_store = True
589
596
 
590
597
  for current_flag in self.http.extra_args:
591
598
  if current_flag.no_parent_script:
@@ -309,6 +309,8 @@ class HttpFileFormatter(RequestBase):
309
309
  output_str += f"@clear{new_line}"
310
310
  if extra_arg.insecure:
311
311
  output_str += f"@insecure{new_line}"
312
+ if extra_arg.enable_trust_store:
313
+ output_str += f"@enable_trust_store{new_line}"
312
314
  method = http.urlwrap.method if http.urlwrap.method else "GET"
313
315
  output_str += f'{method} "{http.urlwrap.url}"'
314
316
  if certificate := http.certificate:
@@ -322,6 +324,8 @@ class HttpFileFormatter(RequestBase):
322
324
  output_str += f"{new_line}p12(file={apply_quote_or_unquote(certificate.p12_file)}, password={apply_quote_or_unquote(certificate.password)})"
323
325
  else:
324
326
  output_str += f"{new_line}p12(file={apply_quote_or_unquote(certificate.p12_file)})"
327
+ if trust := getattr(http, "trust", None):
328
+ output_str += f"{new_line}trust({apply_quote_or_unquote(trust.root)})"
325
329
  if auth_wrap := http.authwrap:
326
330
  if basic_auth := auth_wrap.basic_auth:
327
331
  output_str += f'{new_line}basicauth("{basic_auth.username}", "{basic_auth.password}")'
@@ -575,7 +579,9 @@ class RequestCompiler(RequestBase):
575
579
  else:
576
580
 
577
581
  def func(data):
578
- return output.write(data.decode())
582
+ return output.write(
583
+ data.decode(resp.encoding or "utf-8", errors="replace")
584
+ )
579
585
 
580
586
  for data in resp.iter_content(1024):
581
587
  func(data)
@@ -638,6 +644,11 @@ class RequestCompiler(RequestBase):
638
644
  request = self.get_request()
639
645
  session.cookies = request._cookies
640
646
 
647
+ if self.httpdef.enable_trust_store:
648
+ import truststore
649
+
650
+ truststore.inject_into_ssl()
651
+
641
652
  # Create retry adapter if configured (doesn't modify session)
642
653
  retry_adapter = self._create_retry_adapter()
643
654
 
@@ -649,6 +660,11 @@ class RequestCompiler(RequestBase):
649
660
  pkcs12_password=self.httpdef.p12[1],
650
661
  ),
651
662
  )
663
+ verify = (
664
+ False
665
+ if self.httpdef.allow_insecure
666
+ else self.httpdef.trust_root or True
667
+ )
652
668
  try:
653
669
  if self.httpdef.certificate:
654
670
  cert = tuple(self.httpdef.certificate)
@@ -658,7 +674,7 @@ class RequestCompiler(RequestBase):
658
674
  # Prepare kwargs for session.send
659
675
  send_kwargs = {
660
676
  'cert': cert,
661
- 'verify': not self.httpdef.allow_insecure,
677
+ 'verify': verify,
662
678
  }
663
679
 
664
680
  # Handle proxy configuration
@@ -694,7 +710,7 @@ class RequestCompiler(RequestBase):
694
710
 
695
711
  send_kwargs = {
696
712
  'cert': self.httpdef.certificate,
697
- 'verify': not self.httpdef.allow_insecure,
713
+ 'verify': verify,
698
714
  }
699
715
  if self.httpdef.timeout:
700
716
  send_kwargs['timeout'] = self.httpdef.timeout
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "dothttp-req"
3
- version = "0.0.44a36"
3
+ version = "0.0.44a37"
4
4
  description = "Dothttp is Simple http client for testing and development"
5
5
  authors = ["Prasanth <kesavarapu.siva@gmail.com>"]
6
6
  license = "MIT"
@@ -21,7 +21,7 @@ dothttp = 'dothttp.__main__:main'
21
21
 
22
22
 
23
23
  [tool.poetry.dependencies]
24
- python = ">=3.10,<3.15"
24
+ python = ">=3.12,<3.15"
25
25
  jsonschema = "4.26.0"
26
26
  jstyleson = "0.0.2"
27
27
  textx = "4.2.3"
@@ -29,14 +29,15 @@ requests-pkcs12 = "1.27"
29
29
  parsys-requests-unixsocket = "0.3.2"
30
30
  requests-aws4auth = "1.3.2"
31
31
  requests-ntlm = "1.3.0"
32
- restrictedpython = "8.4"
32
+ restrictedpython = "8.5"
33
33
  faker = "40.21.0"
34
34
  requests-hawk = "1.2.1"
35
- msal = "1.37.0"
35
+ msal = "1.38.0"
36
36
  pyyaml = "6.0.3"
37
37
  toml = "0.10.2"
38
38
  requests = "2.34.2"
39
- cryptography = "50.0.0"
39
+ cryptography = "50.0.1"
40
+ truststore = "0.10.4"
40
41
  urllib3 = "2.7.0"
41
42
  idna = "3.18"
42
43
  xmltodict = "^1.0.2"
@@ -46,10 +47,10 @@ waitress = "3.0.2"
46
47
  flask = "3.1.3"
47
48
  python-magic = "^0.4.27"
48
49
  flask-cors = "^6.0.5"
49
- pytest = "9.0.3"
50
+ pytest = "9.1.1"
50
51
  pytest-html = "^4.2.0"
51
52
  pytest-xdist = "^3.6.1"
52
- gunicorn = "^23.0.0"
53
+ gunicorn = "^26.2.0"
53
54
  httpbin = "^0.10.4"
54
55
 
55
56
  [build-system]