added http auth and upload functions

This commit is contained in:
Luxferre
2025-12-25 15:48:27 +02:00
parent 2e589df792
commit 1d3b5f99f5
2 changed files with 50 additions and 1 deletions
+2
View File
@@ -158,7 +158,9 @@ Exports the following functions:
- `http_set_ua(ua_str='Mozilla/5.0')`: set a default HTTP user agent string
- `http_fetch(url, useragent=None, hdrs={})`: fetch text content from a URL into a string (returns `(status_code, content)` tuple)
- `auth_header(username, password)`: get an dictionary fragment with the corresponding HTTP Basic Auth header according to the username and password
- `wget(url, filename='', useragent=None, hdrs={})`: download a file into a local path (returns `(status_code, filename)` tuple)
- `wput(url, file_path, field_name="file", method="POST", format="x-www-form-urlencoded", headers=None)`: upload a file from a local path in the `x-www-form-urlencoded` or JSON format (returns `(status_code, content)` tuple)
### `deck.llm`