Tag Archives: upload

Google Drive API v3 (googleapiclient.errors.HttpError 404 File not found)

If you try to upload a file in a shared drive (in Google Drive) you may get the above error.

This is my experience and solution as of February 2024 using Python 3.10.

from googleapiclient.discovery import build
from googleapiclient.http import MediaFileUpload
from google.oauth2 import service_account

from io import BytesIO
from googleapiclient.http import MediaIoBaseUpload
from google.cloud import translate_v2 as translate

## Credentials of service account
credentials = service_account.Credentials.from_service_account_info(service_account_info, scopes=['https://www.googleapis.com/auth/drive'])

## API Client Service
service = build("drive", "v3", credentials=credentials)

# buffer_memory=BytesIO(b"some initial binary data: \x00\x01") # BytesIO() new_body
buffer_memory=BytesIO() # BytesIO() new_body

## Prepare the file in memory (you can upload local file too with MediaBase Upload)
media_body = MediaIoBaseUpload(buffer_memory, mimetype='text/html', 
        chunksize=1024*1024, resumable=False)
                body = {
                        'title': file_name,
                        "name": file_name,
                        "mimeType": "application/vnd.google-apps.document",
                        "driveId": "0APee............PVA",
                        "parents": ['0APe.............PVA'],

## Upload file
returned_fields="id, name, mimeType, size, webViewLink, exportLinks"
upload_response=service.files().create( body=body,                                                            

## Share the created file with user
user_permission = {
                    "type": "user",
                    "role": "writer",
                    "emailAddress": share_user,
                perm_response = service.permissions().create(

The important difference between uploading in private Google drive is that you have to use the following parameters for Shared Drives:

driveId -> Id of Shared Drive
parents -> Folder or Shared Drive

Mime Types: List of the supported Mime type here


If you want to convert the uploaded file to Google Drive native format use the following parameter:

"mimeType": "application/vnd.google-apps.document",

Google documentation: https://developers.google.com/drive/api/guides/manage-uploads

And this article on StackOverflow as well helped to find the solution although some parameters are wrong or deprecated already: https://stackoverflow.com/questions/67622131/google-drive-api-v3-googleapiclient-errors-httperror-404-file-not-found

iOS and iPhone ring tone from video or audio file

In two easy steps you can convert any video or audio file to iOS ringtone.

  1. You need to convert the desired tone/music into M4R format first.
    For this you I use: https://www.online-convert.com/
    The nice option is that you can set start and end time (trim) the output file!
  2. If you are with MacOS, you can use Music app to upload the M4R ringtone using your iPhone cable.
    It is shown in this short video how to upload ringtone to iOS via Music app on Mac: https://www.youtube.com/watch?v=gdv5GTQFyGE

Как да си направите рингтон за iOS от видео или аудио файл в две лесни стъпки.

  1. Трябва да конвертирате желаната музика или звук в M4R формат първо.
    Аз използвам този сайт, който предлага и задаване да се отреже само част от музиката: https://www.online-convert.com/
  2. Ако сте с MacOS можете лесно с кабела на iPhone-а да си качите рингтона като използвате приложението Music:
    В това кратко видео е показано как се качва рингтон (мелодия за звънене) на iPhone чрез приложението Music на MacOS: https://www.youtube.com/watch?v=gdv5GTQFyGE