django_youtube/api.py
def upload(self, title, description="", keywords="", developer_tags=None, access_control=AccessControl.Public):
        """
        Browser based upload
        Creates the video entry and meta data to initiate a browser upload

        Authentication is needed

        Params:
            title: string
            description: string
            keywords: comma seperated string
            developer_tags: tuple

        Return:
            dict contains post_url and youtube_token. i.e { 'post_url': post_url, 'youtube_token': youtube_token }

        Raises:
            ApiError: on no authentication
        """
        # Raise ApiError if not authenticated
        if not self.authenticated:
            raise ApiError(_("Authentication is required"))

        # create media group
        my_media_group = gdata.media.Group(
            title=gdata.media.Title(text=title),
            description=gdata.media.Description(description_type='plain',
                                                text=description),
            keywords=gdata.media.Keywords(text=keywords),
            category=[gdata.media.Category(
                text='Autos',
                scheme='http://gdata.youtube.com/schemas/2007/categories.cat',
                label='Autos')],
            #player = None
        )

        # Access Control
        extension = self._access_control(access_control, my_media_group)

        # create video entry
        video_entry = gdata.youtube.YouTubeVideoEntry(
            media=my_media_group, extension_elements=extension)

        # add developer tags
        if developer_tags:
            video_entry.AddDeveloperTags(developer_tags)

        # upload meta data only
        response = Api.yt_service.GetFormUploadToken(video_entry)

        # parse response tuple and use the variables to build a form
        post_url = response[0]
        youtube_token = response[1]

        return {'post_url': post_url, 'youtube_token': youtube_token}
def upload(self, title, description="", keywords="", developer_tags=None, access_control=AccessControl.Public):
        # Raise ApiError if not authenticated
        if not self.authenticated:
            raise ApiError(_("Authentication is required"))

        # create media group
        my_media_group = gdata.media.Group(
            title=gdata.media.Title(text=title),
            description=gdata.media.Description(description_type='plain',
                                                text=description),
            keywords=gdata.media.Keywords(text=keywords),
            category=[gdata.media.Category(
                text='Autos',
                scheme='http://gdata.youtube.com/schemas/2007/categories.cat',
                label='Autos')],
            #player = None
        )

        # Access Control
        extension = self._access_control(access_control, my_media_group)

        # create video entry
        video_entry = gdata.youtube.YouTubeVideoEntry(
            media=my_media_group, extension_elements=extension)

        # add developer tags
        if developer_tags:
            video_entry.AddDeveloperTags(developer_tags)

        # upload meta data only
        response = Api.yt_service.GetFormUploadToken(video_entry)

        # parse response tuple and use the variables to build a form
        post_url = response[0]
        youtube_token = response[1]

        return {'post_url': post_url, 'youtube_token': youtube_token}
def upload ( self , title , description = "" , keywords = "" , developer_tags = None , access_control = AccessControl . Public ) : # Raise ApiError if not authenticated if not self . authenticated : raise ApiError ( _ ( "Authentication is required" ) ) # create media group my_media_group = gdata . media . Group ( title = gdata . media . Title ( text = title ) , description = gdata . media . Description ( description_type = 'plain' , text = description ) , keywords = gdata . media . Keywords ( text = keywords ) , category = [ gdata . media . Category ( text = 'Autos' , scheme = 'http://gdata.youtube.com/schemas/2007/categories.cat' , label = 'Autos' ) ] , #player = None ) # Access Control extension = self . _access_control ( access_control , my_media_group ) # create video entry video_entry = gdata . youtube . YouTubeVideoEntry ( media = my_media_group , extension_elements = extension ) # add developer tags if developer_tags : video_entry . AddDeveloperTags ( developer_tags ) # upload meta data only response = Api . yt_service . GetFormUploadToken ( video_entry ) # parse response tuple and use the variables to build a form post_url = response [ 0 ] youtube_token = response [ 1 ] return { 'post_url' : post_url , 'youtube_token' : youtube_token }
Browser based upload
        Creates the video entry and meta data to initiate a browser upload

        Authentication is needed

        Params:
            title: string
            description: string
            keywords: comma seperated string
            developer_tags: tuple

        Return:
            dict contains post_url and youtube_token. i.e { 'post_url': post_url, 'youtube_token': youtube_token }

        Raises:
            ApiError: on no authentication
Browser based upload Creates the video entry and meta data to initiate a browser upload