dothttp-req 0.0.44a30__tar.gz → 0.0.44a31__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.
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/PKG-INFO +6 -4
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dothttp/http.tx +20 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dothttp/models/computed.py +6 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dothttp/models/parse_models.py +27 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dothttp/parse/__init__.py +50 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dothttp/parse/request_base.py +119 -13
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dothttp/utils/json_utils.py +6 -1
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/pyproject.toml +7 -5
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/LICENSE.txt +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/README.md +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dotextensions/__init__.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dotextensions/server/__init__.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dotextensions/server/__main__.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dotextensions/server/agent.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dotextensions/server/handlers/__init__.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dotextensions/server/handlers/basic_handlers.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dotextensions/server/handlers/fs_handlers.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dotextensions/server/handlers/gohandler.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dotextensions/server/handlers/har2httphandler.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dotextensions/server/handlers/http2har.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dotextensions/server/handlers/http2postman.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dotextensions/server/handlers/postman2http.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dotextensions/server/models/__init__.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dotextensions/server/models/har.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dotextensions/server/postman/__init__.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dotextensions/server/postman2_1/__init__.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dotextensions/server/server.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dotextensions/server/utils.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dotextensions/version/__init__.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dotextensions/version/__main__.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dothttp/__init__.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dothttp/__main__.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dothttp/__version__.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dothttp/auth/__init__.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dothttp/auth/azure_auth.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dothttp/exceptions.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dothttp/models/__init__.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dothttp/parse/dsl_jsonparser.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dothttp/parse/expression.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dothttp/postScript.js +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dothttp/property_schema.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dothttp/script/__init__.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dothttp/script/js3py.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dothttp/utils/__init__.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dothttp/utils/common.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dothttp/utils/constants.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dothttp/utils/curl_utils.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dothttp/utils/log_utils.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dothttp/utils/property_util.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dothttp_test/__init__.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dothttp_test/__main__.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dothttp_test/conftest.py +0 -0
- {dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dothttp_test/dothttp_test.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dothttp-req
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.44a31
|
|
4
4
|
Summary: Dothttp is Simple http client for testing and development
|
|
5
5
|
License: MIT
|
|
6
6
|
License-File: LICENSE.txt
|
|
@@ -15,20 +15,22 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.12
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.13
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
-
Requires-Dist: faker (==
|
|
19
|
-
Requires-Dist:
|
|
18
|
+
Requires-Dist: faker (==40.18.0)
|
|
19
|
+
Requires-Dist: idna (==3.15)
|
|
20
|
+
Requires-Dist: jsonschema (==4.26.0)
|
|
20
21
|
Requires-Dist: jstyleson (==0.0.2)
|
|
21
22
|
Requires-Dist: msal (==1.34.0)
|
|
22
23
|
Requires-Dist: parsys-requests-unixsocket (==0.3.2)
|
|
23
24
|
Requires-Dist: pyyaml (==6.0.3)
|
|
24
25
|
Requires-Dist: requests (==2.32.5)
|
|
25
|
-
Requires-Dist: requests-aws4auth (==1.3.
|
|
26
|
+
Requires-Dist: requests-aws4auth (==1.3.2)
|
|
26
27
|
Requires-Dist: requests-hawk (==1.2.1)
|
|
27
28
|
Requires-Dist: requests-ntlm (==1.3.0)
|
|
28
29
|
Requires-Dist: requests-pkcs12 (==1.27)
|
|
29
30
|
Requires-Dist: restrictedpython (==8.1)
|
|
30
31
|
Requires-Dist: textx (==4.2.3)
|
|
31
32
|
Requires-Dist: toml (==0.10.2)
|
|
33
|
+
Requires-Dist: urllib3 (==2.7.0)
|
|
32
34
|
Requires-Dist: xmltodict (>=1.0.2,<2.0.0)
|
|
33
35
|
Project-URL: Bug Tracker, https://github.com/cedric05/dothttp
|
|
34
36
|
Description-Content-Type: text/markdown
|
|
@@ -29,6 +29,9 @@ HTTP:
|
|
|
29
29
|
urlwrap=URL
|
|
30
30
|
(authwrap=AUTHWRAP)?
|
|
31
31
|
(certificate = CERTAUTH)?
|
|
32
|
+
(timeout=TIMEOUT)?
|
|
33
|
+
(retry=RETRY)?
|
|
34
|
+
(proxy=PROXY)?
|
|
32
35
|
(lines *= LINE)?
|
|
33
36
|
(payload=PAYLOAD)?
|
|
34
37
|
(output=TOFILE)?
|
|
@@ -133,6 +136,23 @@ AZURECLIAUTH:
|
|
|
133
136
|
'azurecli' '(' (('scope' '=')? scope=DotString )? ')'
|
|
134
137
|
;
|
|
135
138
|
|
|
139
|
+
TIMEOUT:
|
|
140
|
+
'timeout' '(' timeout_seconds=DotString ')'
|
|
141
|
+
;
|
|
142
|
+
|
|
143
|
+
RETRY:
|
|
144
|
+
'retry' '(' retry_params*=RETRY_PARAM[','] ','? ')'
|
|
145
|
+
;
|
|
146
|
+
|
|
147
|
+
RETRY_PARAM:
|
|
148
|
+
('total' '=' total=DotString)
|
|
149
|
+
| ('status_forcelist' '=' '[' status_forcelist*=DotString[','] ','? ']')
|
|
150
|
+
| ('backoff_factor' '=' backoff_factor=DotString)
|
|
151
|
+
;
|
|
152
|
+
|
|
153
|
+
PROXY:
|
|
154
|
+
'proxy' '(' proxy=DotString ')'
|
|
155
|
+
;
|
|
136
156
|
|
|
137
157
|
EXTRA_ARG:
|
|
138
158
|
// there can be more
|
|
@@ -88,6 +88,12 @@ class HttpDef:
|
|
|
88
88
|
test_script: str = ""
|
|
89
89
|
test_script_lang: ScriptType = ScriptType.PYTHON
|
|
90
90
|
proxy: Optional[Dict[str, str]] = None
|
|
91
|
+
timeout: Optional[float] = None
|
|
92
|
+
# Retry fields - most commonly used urllib3.Retry parameters
|
|
93
|
+
retry_total: Optional[int] = None
|
|
94
|
+
retry_status_forcelist: Optional[List[int]] = None
|
|
95
|
+
retry_backoff_factor: Optional[float] = None
|
|
96
|
+
custom_proxy: Optional[str] = None
|
|
91
97
|
|
|
92
98
|
def get_har(self):
|
|
93
99
|
if self.auth:
|
|
@@ -126,6 +126,30 @@ class AuthWrap:
|
|
|
126
126
|
azure_auth: Optional[AzureAuthWrap] = None
|
|
127
127
|
|
|
128
128
|
|
|
129
|
+
@dataclass
|
|
130
|
+
class Timeout:
|
|
131
|
+
timeout_seconds: str
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
@dataclass
|
|
135
|
+
class RetryParam:
|
|
136
|
+
"""Most commonly used urllib3.Retry parameters"""
|
|
137
|
+
total: Optional[str] = None
|
|
138
|
+
status_forcelist: Optional[List[str]] = None
|
|
139
|
+
backoff_factor: Optional[str] = None
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
@dataclass
|
|
143
|
+
class Retry:
|
|
144
|
+
"""Maps to commonly-used urllib3.Retry parameters"""
|
|
145
|
+
retry_params: Optional[List[RetryParam]] = None
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
@dataclass
|
|
149
|
+
class Proxy:
|
|
150
|
+
proxy: str
|
|
151
|
+
|
|
152
|
+
|
|
129
153
|
@dataclass
|
|
130
154
|
class Query:
|
|
131
155
|
key: str
|
|
@@ -225,6 +249,9 @@ class Http:
|
|
|
225
249
|
lines: Optional[List[Line]]
|
|
226
250
|
payload: Optional[Payload]
|
|
227
251
|
output: Optional[ToFile]
|
|
252
|
+
timeout: Optional[Timeout] = None
|
|
253
|
+
retry: Optional[Retry] = None
|
|
254
|
+
proxy: Optional[Proxy] = None
|
|
228
255
|
description: Optional[str] = None
|
|
229
256
|
extra_args: Optional[List[ExtraArg]] = field(default_factory=lambda: [])
|
|
230
257
|
named_args: Optional[List[NamedArg]] = field(default_factory=lambda: [])
|
|
@@ -467,6 +467,53 @@ class HttpDefBase(BaseModelProcessor):
|
|
|
467
467
|
else None
|
|
468
468
|
)
|
|
469
469
|
|
|
470
|
+
def load_timeout(self):
|
|
471
|
+
"""Load timeout from current request or parent with inheritance"""
|
|
472
|
+
timeout_wrap = self.get_current_or_base("timeout")
|
|
473
|
+
if timeout_wrap:
|
|
474
|
+
timeout_str = self.get_updated_content(timeout_wrap.timeout_seconds)
|
|
475
|
+
try:
|
|
476
|
+
self.httpdef.timeout = float(timeout_str)
|
|
477
|
+
request_logger.debug(f"timeout set to {self.httpdef.timeout} seconds")
|
|
478
|
+
except ValueError:
|
|
479
|
+
base_logger.error(f"Invalid timeout value: {timeout_str}")
|
|
480
|
+
|
|
481
|
+
def load_retry(self):
|
|
482
|
+
"""Load retry configuration - maps to commonly-used urllib3.Retry parameters"""
|
|
483
|
+
retry_wrap = self.get_current_or_base("retry")
|
|
484
|
+
if not retry_wrap or not retry_wrap.retry_params:
|
|
485
|
+
return
|
|
486
|
+
|
|
487
|
+
try:
|
|
488
|
+
# Process each retry parameter
|
|
489
|
+
for param in retry_wrap.retry_params:
|
|
490
|
+
if param.total:
|
|
491
|
+
self.httpdef.retry_total = int(self.get_updated_content(param.total))
|
|
492
|
+
|
|
493
|
+
if param.status_forcelist:
|
|
494
|
+
self.httpdef.retry_status_forcelist = [
|
|
495
|
+
int(self.get_updated_content(code))
|
|
496
|
+
for code in param.status_forcelist
|
|
497
|
+
]
|
|
498
|
+
|
|
499
|
+
if param.backoff_factor:
|
|
500
|
+
self.httpdef.retry_backoff_factor = float(self.get_updated_content(param.backoff_factor))
|
|
501
|
+
|
|
502
|
+
request_logger.debug(
|
|
503
|
+
f"retry configured: total={self.httpdef.retry_total}, "
|
|
504
|
+
f"backoff_factor={self.httpdef.retry_backoff_factor}"
|
|
505
|
+
)
|
|
506
|
+
except (ValueError, TypeError) as e:
|
|
507
|
+
base_logger.error(f"Invalid retry configuration: {e}")
|
|
508
|
+
|
|
509
|
+
def load_custom_proxy(self):
|
|
510
|
+
"""Load custom proxy from current request or parent with inheritance"""
|
|
511
|
+
proxy_wrap = self.get_current_or_base("proxy")
|
|
512
|
+
if proxy_wrap:
|
|
513
|
+
proxy_url = self.get_updated_content(proxy_wrap.proxy)
|
|
514
|
+
self.httpdef.custom_proxy = proxy_url
|
|
515
|
+
request_logger.debug(f"custom proxy set: {proxy_url}")
|
|
516
|
+
|
|
470
517
|
def load_headers(self):
|
|
471
518
|
"""
|
|
472
519
|
entrypoints
|
|
@@ -935,6 +982,9 @@ class HttpDefBase(BaseModelProcessor):
|
|
|
935
982
|
self.load_payload()
|
|
936
983
|
self.load_auth()
|
|
937
984
|
self.load_proxy()
|
|
985
|
+
self.load_timeout()
|
|
986
|
+
self.load_retry()
|
|
987
|
+
self.load_custom_proxy()
|
|
938
988
|
self.load_certificate()
|
|
939
989
|
self.load_output()
|
|
940
990
|
self._loaded = True
|
|
@@ -8,6 +8,8 @@ from urllib.parse import unquote, urlparse, urlunparse
|
|
|
8
8
|
|
|
9
9
|
import jstyleson as json
|
|
10
10
|
from requests import PreparedRequest, Response, Session
|
|
11
|
+
from requests.adapters import HTTPAdapter
|
|
12
|
+
from urllib3.util.retry import Retry
|
|
11
13
|
|
|
12
14
|
# this is bad, loading private stuff. find a better way
|
|
13
15
|
from requests.exceptions import SSLError
|
|
@@ -123,7 +125,7 @@ class RequestBase(HttpDefBase):
|
|
|
123
125
|
|
|
124
126
|
def get_session(self):
|
|
125
127
|
if self.httpdef.session_clear:
|
|
126
|
-
#
|
|
128
|
+
# caller should close session
|
|
127
129
|
# TODO
|
|
128
130
|
return get_new_session()
|
|
129
131
|
session = self.global_session
|
|
@@ -346,6 +348,30 @@ class HttpFileFormatter(RequestBase):
|
|
|
346
348
|
output_str += f'{new_line}azurespcert("tenant_id={cert_auth.tenant_id}", client_id="{cert_auth.client_id}", client_secret="{cert_auth.certificate_path}", scope="{cert_auth.scope}")'
|
|
347
349
|
else:
|
|
348
350
|
output_str += f'{new_line}azurecli( scope = "{azure_auth.scope}")'
|
|
351
|
+
|
|
352
|
+
# Format timeout
|
|
353
|
+
if timeout := http.timeout:
|
|
354
|
+
output_str += f'{new_line}timeout({timeout.timeout_seconds})'
|
|
355
|
+
|
|
356
|
+
# Format retry
|
|
357
|
+
if retry := http.retry:
|
|
358
|
+
if retry.retry_params:
|
|
359
|
+
params = []
|
|
360
|
+
for param in retry.retry_params:
|
|
361
|
+
if param.total:
|
|
362
|
+
params.append(f'total={param.total}')
|
|
363
|
+
if param.backoff_factor:
|
|
364
|
+
params.append(f'backoff_factor={param.backoff_factor}')
|
|
365
|
+
if param.status_forcelist:
|
|
366
|
+
codes = ', '.join(param.status_forcelist)
|
|
367
|
+
params.append(f'status_forcelist=[{codes}]')
|
|
368
|
+
if params:
|
|
369
|
+
output_str += f'{new_line}retry({", ".join(params)})'
|
|
370
|
+
|
|
371
|
+
# Format proxy
|
|
372
|
+
if proxy := http.proxy:
|
|
373
|
+
output_str += f'{new_line}proxy({apply_quote_or_unquote(proxy.proxy)})'
|
|
374
|
+
|
|
349
375
|
if lines := http.lines:
|
|
350
376
|
|
|
351
377
|
def check_for_quotes(line):
|
|
@@ -555,10 +581,59 @@ class RequestCompiler(RequestBase):
|
|
|
555
581
|
)
|
|
556
582
|
eprint("output file close failed")
|
|
557
583
|
|
|
584
|
+
def _create_retry_adapter(self):
|
|
585
|
+
"""
|
|
586
|
+
Create a retry adapter based on httpdef retry settings.
|
|
587
|
+
|
|
588
|
+
Returns HTTPAdapter with retry configuration, or None if no retry is configured.
|
|
589
|
+
This adapter can be used directly with adapter.send() without mounting on session.
|
|
590
|
+
|
|
591
|
+
Passes parameters directly to urllib3.Retry without additional processing.
|
|
592
|
+
"""
|
|
593
|
+
# Check if any retry configuration exists
|
|
594
|
+
if self.httpdef.retry_total is None:
|
|
595
|
+
return None # No retry configuration
|
|
596
|
+
|
|
597
|
+
# Build kwargs for Retry, passing only configured parameters
|
|
598
|
+
retry_kwargs = {}
|
|
599
|
+
|
|
600
|
+
if self.httpdef.retry_total is not None:
|
|
601
|
+
retry_kwargs['total'] = self.httpdef.retry_total
|
|
602
|
+
|
|
603
|
+
if self.httpdef.retry_status_forcelist is not None:
|
|
604
|
+
retry_kwargs['status_forcelist'] = self.httpdef.retry_status_forcelist
|
|
605
|
+
|
|
606
|
+
if self.httpdef.retry_backoff_factor is not None:
|
|
607
|
+
retry_kwargs['backoff_factor'] = self.httpdef.retry_backoff_factor
|
|
608
|
+
|
|
609
|
+
# Always set raise_on_status=False for API testing tools
|
|
610
|
+
# Users want to see the response regardless of status code
|
|
611
|
+
retry_kwargs['raise_on_status'] = False
|
|
612
|
+
|
|
613
|
+
# Create retry strategy with configured parameters
|
|
614
|
+
retry_strategy = Retry(**retry_kwargs)
|
|
615
|
+
|
|
616
|
+
# Create adapter with retry strategy
|
|
617
|
+
adapter = HTTPAdapter(max_retries=retry_strategy)
|
|
618
|
+
|
|
619
|
+
request_logger.debug(f"Retry adapter created with: {retry_kwargs}")
|
|
620
|
+
|
|
621
|
+
return adapter
|
|
622
|
+
|
|
558
623
|
def get_response(self):
|
|
624
|
+
"""
|
|
625
|
+
Get HTTP response with optional retry support via urllib3.Retry.
|
|
626
|
+
|
|
627
|
+
Uses adapter.send() directly if retry is configured, avoiding session
|
|
628
|
+
state modification and ensuring thread-safety in concurrent environments.
|
|
629
|
+
"""
|
|
559
630
|
session = self.get_session()
|
|
560
631
|
request = self.get_request()
|
|
561
632
|
session.cookies = request._cookies
|
|
633
|
+
|
|
634
|
+
# Create retry adapter if configured (doesn't modify session)
|
|
635
|
+
retry_adapter = self._create_retry_adapter()
|
|
636
|
+
|
|
562
637
|
if self.httpdef.p12:
|
|
563
638
|
session.mount(
|
|
564
639
|
request.url,
|
|
@@ -572,13 +647,36 @@ class RequestCompiler(RequestBase):
|
|
|
572
647
|
cert = tuple(self.httpdef.certificate)
|
|
573
648
|
else:
|
|
574
649
|
cert = None
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
650
|
+
|
|
651
|
+
# Prepare kwargs for session.send
|
|
652
|
+
send_kwargs = {
|
|
653
|
+
'cert': cert,
|
|
654
|
+
'verify': not self.httpdef.allow_insecure,
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
# Handle proxy configuration
|
|
658
|
+
# Priority: custom_proxy (from DSL) > proxy (from named_args)
|
|
659
|
+
if self.httpdef.custom_proxy:
|
|
660
|
+
send_kwargs['proxies'] = {
|
|
661
|
+
'http': self.httpdef.custom_proxy,
|
|
662
|
+
'https': self.httpdef.custom_proxy,
|
|
663
|
+
}
|
|
664
|
+
request_logger.debug(f"Using custom proxy: {self.httpdef.custom_proxy}")
|
|
665
|
+
elif self.httpdef.proxy:
|
|
666
|
+
send_kwargs['proxies'] = self.httpdef.proxy
|
|
667
|
+
|
|
668
|
+
# Add timeout if configured
|
|
669
|
+
if self.httpdef.timeout:
|
|
670
|
+
send_kwargs['timeout'] = self.httpdef.timeout
|
|
671
|
+
|
|
672
|
+
# Use retry adapter if configured, otherwise use session.send()
|
|
673
|
+
if retry_adapter:
|
|
674
|
+
# Call adapter.send() directly - no need to mount on session!
|
|
675
|
+
# This keeps session state clean and is thread-safe
|
|
676
|
+
resp: Response = retry_adapter.send(request, **send_kwargs)
|
|
677
|
+
else:
|
|
678
|
+
# Normal request without retry
|
|
679
|
+
resp: Response = session.send(request, **send_kwargs)
|
|
582
680
|
except UnicodeEncodeError:
|
|
583
681
|
# for Chinese, smiley all other default encode converts into latin-1
|
|
584
682
|
# as latin-1 didn't consist of those characters it will fail
|
|
@@ -586,11 +684,19 @@ class RequestCompiler(RequestBase):
|
|
|
586
684
|
# as a last resort, it may not be correct solution. may be it is.
|
|
587
685
|
# for now proceeding with this
|
|
588
686
|
request.prepare_body(request.body.encode("utf-8"), files=None)
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
cert
|
|
592
|
-
verify
|
|
593
|
-
|
|
687
|
+
|
|
688
|
+
send_kwargs = {
|
|
689
|
+
'cert': self.httpdef.certificate,
|
|
690
|
+
'verify': not self.httpdef.allow_insecure,
|
|
691
|
+
}
|
|
692
|
+
if self.httpdef.timeout:
|
|
693
|
+
send_kwargs['timeout'] = self.httpdef.timeout
|
|
694
|
+
|
|
695
|
+
# Use retry adapter if configured
|
|
696
|
+
if retry_adapter:
|
|
697
|
+
resp: Response = retry_adapter.send(request, **send_kwargs)
|
|
698
|
+
else:
|
|
699
|
+
resp: Response = session.send(request, **send_kwargs)
|
|
594
700
|
# in case of ssl self signed error, try to catch it and add more info
|
|
595
701
|
# to user
|
|
596
702
|
except SSLError as e:
|
|
@@ -79,6 +79,11 @@ class JSONEncoder(json.JSONEncoder):
|
|
|
79
79
|
|
|
80
80
|
return text
|
|
81
81
|
|
|
82
|
+
# Convert indent to string if it's an integer (for Python 3.13+ compatibility)
|
|
83
|
+
indent = self.indent
|
|
84
|
+
if isinstance(indent, int):
|
|
85
|
+
indent = ' ' * indent
|
|
86
|
+
|
|
82
87
|
if _one_shot and c_make_encoder is not None and self.indent is None:
|
|
83
88
|
_iterencode = c_make_encoder(
|
|
84
89
|
markers,
|
|
@@ -96,7 +101,7 @@ class JSONEncoder(json.JSONEncoder):
|
|
|
96
101
|
markers,
|
|
97
102
|
self.default,
|
|
98
103
|
_encoder,
|
|
99
|
-
|
|
104
|
+
indent,
|
|
100
105
|
floatstr,
|
|
101
106
|
self.key_separator,
|
|
102
107
|
self.item_separator,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "dothttp-req"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.44a31"
|
|
4
4
|
description = "Dothttp is Simple http client for testing and development"
|
|
5
5
|
authors = ["Prasanth <kesavarapu.siva@gmail.com>"]
|
|
6
6
|
license = "MIT"
|
|
@@ -22,20 +22,22 @@ dothttp = 'dothttp.__main__:main'
|
|
|
22
22
|
|
|
23
23
|
[tool.poetry.dependencies]
|
|
24
24
|
python = ">=3.10,<3.15"
|
|
25
|
-
jsonschema = "4.
|
|
25
|
+
jsonschema = "4.26.0"
|
|
26
26
|
jstyleson = "0.0.2"
|
|
27
27
|
textx = "4.2.3"
|
|
28
28
|
requests-pkcs12 = "1.27"
|
|
29
29
|
parsys-requests-unixsocket = "0.3.2"
|
|
30
|
-
requests-aws4auth = "1.3.
|
|
30
|
+
requests-aws4auth = "1.3.2"
|
|
31
31
|
requests-ntlm = "1.3.0"
|
|
32
32
|
restrictedpython = "8.1"
|
|
33
|
-
faker = "
|
|
33
|
+
faker = "40.18.0"
|
|
34
34
|
requests-hawk = "1.2.1"
|
|
35
35
|
msal = "1.34.0"
|
|
36
36
|
pyyaml = "6.0.3"
|
|
37
37
|
toml = "0.10.2"
|
|
38
38
|
requests = "2.32.5"
|
|
39
|
+
urllib3 = "2.7.0"
|
|
40
|
+
idna = "3.15"
|
|
39
41
|
xmltodict = "^1.0.2"
|
|
40
42
|
|
|
41
43
|
[tool.poetry.group.dev.dependencies]
|
|
@@ -43,7 +45,7 @@ waitress = "3.0.2"
|
|
|
43
45
|
flask = "3.1.3"
|
|
44
46
|
python-magic = "^0.4.27"
|
|
45
47
|
flask-cors = "^6.0.1"
|
|
46
|
-
pytest = "
|
|
48
|
+
pytest = "9.0.3"
|
|
47
49
|
pytest-html = "^4.1.1"
|
|
48
50
|
pytest-xdist = "^3.6.1"
|
|
49
51
|
gunicorn = "^23.0.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dotextensions/server/handlers/basic_handlers.py
RENAMED
|
File without changes
|
{dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dotextensions/server/handlers/fs_handlers.py
RENAMED
|
File without changes
|
|
File without changes
|
{dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dotextensions/server/handlers/har2httphandler.py
RENAMED
|
File without changes
|
|
File without changes
|
{dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dotextensions/server/handlers/http2postman.py
RENAMED
|
File without changes
|
{dothttp_req-0.0.44a30 → dothttp_req-0.0.44a31}/dotextensions/server/handlers/postman2http.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|