API Reference: CrossClient
CrossClient
Source code in src/crosscontract/crossclient/crossclient.py
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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | |
__init__(username, password, base_url, verify=True)
Initialize the client with authentication.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
username
|
str
|
The username for authentication. |
required |
password
|
str
|
The password for authentication. |
required |
base_url
|
str
|
If provided, use this domain instead of the default BASE_URL. The debug option is ignored if base_url is set. The domain must include the protocol (e.g., http:// or https://). Example: "http://example.com/" |
required |
verify
|
bool
|
Whether to verify SSL certificates. Defaults to True. |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
CrossClient |
None
|
An instance of the authenticated client. |
Source code in src/crosscontract/crossclient/crossclient.py
authenticate()
Authenticate with the server and retrieve an access token.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The authentication token. |
Source code in src/crosscontract/crossclient/crossclient.py
close()
delete(endpoint, **kwargs)
Send a DELETE request to the specified endpoint.
get(endpoint, **kwargs)
patch(endpoint, json=None, **kwargs)
Send a PATCH request to the specified endpoint.
post(endpoint, json=None, **kwargs)
Send a POST request to the specified endpoint.
request(method, endpoint, **kwargs)
Send an HTTP request to the specified endpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
method
|
str
|
The HTTP method (e.g., 'GET', 'POST'). |
required |
endpoint
|
str
|
The API endpoint to send the request to. |
required |
**kwargs
|
dict
|
Additional arguments to pass to the request. |
{}
|
Returns:
| Type | Description |
|---|---|
Response
|
httpx.Response: The response from the server. |