ClientFileMixin#
- class httpx_gracedb.file.ClientFileMixin(*, auth=None, params=None, headers=None, cookies=None, timeout=Timeout(timeout=5.0), follow_redirects=False, max_redirects=20, event_hooks=None, base_url='', trust_env=True, default_encoding='utf-8')[source]#
Bases:
BaseClientA mixin for
httpx.Clientto add features for file uploads.The
httpx.Client.request()method takes afilesargument which is a dictionary of{fieldname: fileobject}, wherefileobjectmay be a file-like object or a tuple of 2-4 elements consisting of the filename, file content, MIME type, and any custom headers.This mixin adds the following features:
The MIME type is automatically guessed from the filename.
If the file content is None, then the filename is treated as a path, and the file is opened and read. If the filename is
-, then the file content is read from stdin.
Methods Summary
build_request(method, url, *[, content, ...])Build and return a request instance.
Methods Documentation
- Parameters:
- build_request(method, url, *, content=None, data=None, files=None, json=None, params=None, headers=None, cookies=None, timeout=Ellipsis, extensions=None)[source]#
Build and return a request instance.
The
params,headersandcookiesarguments
are merged with any values set on the client. * The
urlargument is merged with anybase_urlset on the client.See also: [Request instances][0]
[0]: /advanced/clients/#request-instances