'Google Drive API adding some string in file
I have been trying to replace files using google API only with the Python HTTPS module. But when I replace it. It adds some string to the file with text. Code:
headers = {
"Authorization": "Bearer " + str(Acesstoken),
}
files = {
'file': open("./Test.txt", "rb"),
"mimeType": "text/plain"
}
r2= requests.patch(
"https://www.googleapis.com/upload/drive/v3/files/" + updateFileId,
headers= headers,
files = files,
)
Text On Google Drive Before Replacing File:
Test
Text On Google Drive After Replacing File:
--a164a6e367e3577590ab9eb85b487e21
Content-Disposition: form-data; name="file"; filename="Test.txt"
Test 2
--a164a6e367e3577590ab9eb85b487e21
Content-Disposition: form-data; name="mimeType"; filename="mimeType"
text/plain
--a164a6e367e3577590ab9eb85b487e21--
Advance Thanks to @DaImTo
I've just unlocked talk in chat. I don't mind talking.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
