2013-01-16 2 views
0

특정 사용자의 자격 증명과 짝을 지어 얻은 개발자 키를 사용하여 YouTube에 비디오를 업로드하려고합니다. 내 YoutubeService 개체에 적절한 개발자 자격 증명이 있어야하는 것으로 보이지만이 작업에 403 : 개발자 키가 필요합니다.Python API를 통해 YouTube 업로드를 시도하면 '이 작업에 필요한 개발자 키'오류가 발생합니다. 오류

import gdata 
import gdata.youtube 
import gdata.youtube.service 
client_id = 'dummy-client' 
developer_key = 'xxxxxxx......' 
youtube_user = '[email protected]' 
youtube_password = 'passwordgoeshere' 
yt_service = gdata.youtube.service.YouTubeService(client_id, developer_key) 
yt_service.ssl = True 
yt_service.developer_id = developer_key 
yt_service.client_id = client_id 
yt_service.email = youtube_user 
yt_service.password = youtube_password 
yt_service.source = client_id 
yt_service.ProgrammaticLogin() #Successfully login with the developer key and the user's credentials 

my_media_group = gdata.media.Group(
    title=gdata.media.Title(text='video.avi'), 
    description=gdata.media.Description(description_type='plain', text='My Video'), 
    keywords=gdata.media.Keywords(text=''), 
    category=[gdata.media.Category(
    text='Autos', 
    scheme='http://gdata.youtube.com/schemas/2007/categories.cat', label='Autos')], 
    player=None, 
    private=gdata.media.Private() 
) 
video_entry = gdata.youtube.YouTubeVideoEntry(media=my_media_group) 
video_file_location = '/path/to/video.avi' 

#Use the supposedly authenticated and developer_id associated YoutubeService object to upload the video 
new_entry = yt_service.InsertVideoEntry(video_entry, video_file_location) 

#Receive the following error: 
# 
#Traceback (most recent call last): 
# File "<stdin>", line 1, in <module> 
# File "/usr/lib/python2.7/dist-packages/gdata/youtube/service.py", line 661, in InsertVideoEntry 
# raise YouTubeError(e.args[0]) 
#gdata.youtube.service.YouTubeError: {'status': 403, 'body': 'Developer key required  for this operation', 'reason': 'Forbidden'} 

답변

0

개발자 ID와 개발자 키가 다른 것입니다. yt_service.developer_key에 귀하의 키 (등록 된 특정 응용 프로그램이 아닌 귀하의 계정과 연결되어 있음)를 넣어야합니다.