def videos_insert(client, properties, media_file, **kwargs):
resource = build_resource(properties)
kwargs = remove_empty_kwargs(**kwargs)
request = client.videos().insert(
body=resource,
media_body=MediaFileUpload(media_file, chunksize=-1,
resumable=True),
**kwargs
)
return resumable_upload(request, 'video', 'insert')
media_file = 'sample_video.flv'
if not os.path.exists(media_file):
exit('Please specify a valid file location.')
videos_insert(client,
{'snippet.categoryId': '22',
'snippet.defaultLanguage': '',
'snippet.description': 'Description of uploaded video.',
'snippet.tags[]': '',
'snippet.title': 'Test video upload',
'status.embeddable': '',
'status.license': '',
'status.privacyStatus': 'private',
'status.publicStatsViewable': ''},
media_file,
part='snippet,status')