Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3638

How to handle youtube api method errors in python?

$
0
0

When I do the PlaylistItems.insert() method, how can I handle the videoNotFound error? In addition, how can I handle other errors at the same time like IndexError?

try:    result = youtube.playlistItems().insert(        part = "snippet",        body = {"snippet": {"playlistId": MY_PLAYLIST_ID,"resourceId": {"kind": "youtube#video","videoId": MY_VIDEO_ID                }            }        }    ).execute()    print(my_list[100])except:    #handle videoNotFound error    #handle print(my_list[100]) if it raises an Index Error

Viewing all articles
Browse latest Browse all 3638

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>