-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #189 from FoamyGuy/files_arg
Files arg
- Loading branch information
Showing
13 changed files
with
359 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# SPDX-FileCopyrightText: 2024 Tim Cocks for Adafruit Industries | ||
# SPDX-License-Identifier: MIT | ||
|
||
import adafruit_connection_manager | ||
import wifi | ||
|
||
import adafruit_requests | ||
|
||
URL = "https://httpbin.org/post" | ||
|
||
pool = adafruit_connection_manager.get_radio_socketpool(wifi.radio) | ||
ssl_context = adafruit_connection_manager.get_radio_ssl_context(wifi.radio) | ||
requests = adafruit_requests.Session(pool, ssl_context) | ||
|
||
with open("requests_wifi_file_upload_image.png", "rb") as file_handle: | ||
files = { | ||
"file": ( | ||
"requests_wifi_file_upload_image.png", | ||
file_handle, | ||
"image/png", | ||
{"CustomHeader": "BlinkaRocks"}, | ||
), | ||
"othervalue": (None, "HelloWorld"), | ||
} | ||
|
||
with requests.post(URL, files=files) as response: | ||
print(response.content) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions
2
examples/wifi/expanded/requests_wifi_file_upload_image.png.license
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# SPDX-FileCopyrightText: 2024 Tim Cocks | ||
# SPDX-License-Identifier: CC-BY-4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# SPDX-FileCopyrightText: 2022 Alec Delaney, for Adafruit Industries | ||
# | ||
# SPDX-License-Identifier: Unlicense | ||
|
||
requests |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# SPDX-FileCopyrightText: 2024 Justin Myers | ||
# SPDX-License-Identifier: Unlicense |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# SPDX-FileCopyrightText: 2024 Justin Myers | ||
# SPDX-License-Identifier: Unlicense |
Oops, something went wrong.