Convert Local Image to Upload scalar type #3216
-
I am now working on uploading file using strawberry.file_uploads Upload, I want to ask is there any way to convert my file/image in my local directory to Upload type for testing purpose ? My code will be like this: image_path = "path/to/your/image.jpg" with open(image_path, "rb") as file: // I want to convert the image here and process it |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi, I would recommend using a Python GraphQL client for testing. They take care of the GraphQL multipart file upload protocol which can be tricky to handle by hand. |
Beta Was this translation helpful? Give feedback.
Hi, I would recommend using a Python GraphQL client for testing. They take care of the GraphQL multipart file upload protocol which can be tricky to handle by hand.