Fixed a syntax error in the file upload example (#3692)

This commit is contained in:
ZProger 2025-10-16 11:04:38 +02:00 committed by GitHub
parent 435e1dac89
commit def4778d62
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -191,7 +191,7 @@ You can also explicitly set the filename and content type, by using a tuple
of items for the file value: of items for the file value:
```pycon ```pycon
>>> with open('report.xls', 'rb') report_file: >>> with open('report.xls', 'rb') as report_file:
... files = {'upload-file': ('report.xls', report_file, 'application/vnd.ms-excel')} ... files = {'upload-file': ('report.xls', report_file, 'application/vnd.ms-excel')}
... r = httpx.post("https://httpbin.org/post", files=files) ... r = httpx.post("https://httpbin.org/post", files=files)
>>> print(r.text) >>> print(r.text)