Move requests handling to corelibs_requests module

This commit is contained in:
Clemens Schwaighofer
2026-02-04 14:55:39 +09:00
parent 85063ea5df
commit f265b55ef8
8 changed files with 59 additions and 1404 deletions

View File

@@ -0,0 +1,38 @@
"""
Caller tests
"""
from corelibs_dump_data.dump_data import dump_data
from corelibs.requests_handling.caller import Caller, ErrorResponse
from corelibs.requests_handling.auth_helpers import basic_auth
def test_basic_auth():
"""basic auth test"""
user = "user"
password = "pass"
auth_header = basic_auth(user, password)
print(f"Auth Header for '{user}' & '{password}': {auth_header}")
def test_caller():
"""Caller tests"""
caller = Caller()
response = caller.get("https://httpbin.org/get")
if isinstance(response, ErrorResponse):
print(f"Error: {response.message}")
else:
print(f"Response Status Code: {response.status_code}")
print(f"Response Content: {dump_data(response.json())}")
def main():
"""main"""
test_caller()
test_basic_auth()
if __name__ == "__main__":
main()
# __END__