Server
swerex.server
AUTH_TOKEN
module-attribute
AUTH_TOKEN = ''
api_key_header
module-attribute
api_key_header = APIKeyHeader(name='X-API-Key')
ResponseManager
ResponseManager()
This stores the response of the last request, and is used in retries to return already executed requests.
Note that in the case of multiple concurrent clients, idempotency isn't guaranteed.
Source code in swerex/server.py
50 51 52 |
|
last_processed_request_id
instance-attribute
last_processed_request_id = None
last_processed_response
instance-attribute
last_processed_response = None
get_response
get_response(request_id)
Source code in swerex/server.py
54 55 56 57 |
|
set_response
set_response(request_id, response)
Source code in swerex/server.py
59 60 61 |
|
authenticate
async
authenticate(request: Request, call_next)
Authenticate requests with an API key (if set).
Source code in swerex/server.py
67 68 69 70 71 72 73 74 |
|
close
async
close()
Source code in swerex/server.py
187 188 189 190 |
|
close_session
async
close_session(request: CloseSessionRequest)
Source code in swerex/server.py
142 143 144 |
|
create_session
async
create_session(request: CreateSessionRequest)
Source code in swerex/server.py
132 133 134 |
|
exception_handler
async
exception_handler(request: Request, exc: Exception)
We catch exceptions that are thrown by the runtime, serialize them to JSON and return them to the client so they can reraise them in their own code.
Source code in swerex/server.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
|
execute
async
execute(command: Command)
Source code in swerex/server.py
147 148 149 |
|
handle_request_id
async
handle_request_id(request: Request, call_next)
Handle request ID for idempotency.
Source code in swerex/server.py
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 |
|
is_alive
async
is_alive()
Source code in swerex/server.py
127 128 129 |
|
read_file
async
read_file(request: ReadFileRequest)
Source code in swerex/server.py
152 153 154 |
|
root
async
root()
Source code in swerex/server.py
122 123 124 |
|
run
async
run(action: Action)
Source code in swerex/server.py
137 138 139 |
|
serialize_model
serialize_model(model)
Source code in swerex/server.py
38 39 |
|
upload
async
upload(file: UploadFile = File(...), target_path: str = Form(...), unzip: bool = Form(False))
Source code in swerex/server.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
|
write_file
async
write_file(request: WriteFileRequest)
Source code in swerex/server.py
157 158 159 |
|