Example #1
0
        content_obj = MetaContent(entry = content)
        for meta_obj in content_obj.get_meta_objs():
            print "   * %s" % unicode(meta_obj)

    # Get feed 
    print "Getting content list, using iqmeta=blender ..."
    feed = meta.getContentList(query = Query(params = {"iqmeta":"blender"}))
    feed_obj = Feed(feed)
    for content in feed_obj.entries:
        print ".. found content instance with name = '%s' and %d file(s)" % (content["entry"]["content"]["params"]["name"], len(content["entry"]["content"]["file"]))
        content_obj = MetaContent(entry = content)
        for meta_obj in content_obj.get_meta_objs():
            print "   * %s" % unicode(meta_obj)

    # Delete the content instances
    meta.deleteContent(content1)
    meta.deleteContent(content2)
    meta.deleteContent(content3)
    print "Deleted content + files."

    # delete the files on the CDN
    if rass.dirExists("meta_sample/"):
        rass.deleteDir("meta_sample/", True)
        print "Deleted 'meta_sample' dir from CDN."


except RequestError, e:
    print "Error response returned by RAWS: %s" % unicode(e)

except Exception, e:
    print "Exception occurred: %s" % unicode(e)
Example #2
0
    # create a dir on the CDN
    dir = rass.createDir("crud_test/", True)
    print "Created dir with relative path = '%s'" % dir["entry"]["content"]["params"]["path"]

    # upload a file to a sub-directory (which will be created if it doesn't exist)
    item = rass.createItem("crud_test/subdir/", "filename.mp4", LOCAL_FILE)
    print "Created item with relative path = '%s' and size = %s" % (item["entry"]["content"]["params"]["path"], dir["entry"]["content"]["params"]["size"])
    
    # get list of all files in "crud_test/subdir/"
    print "Getting a list of all files in 'crud_test/subdir/' ..."
    feed = rass.getDirList(path = "crud_test/subdir/", query = Query(params = {"kind":"file"}))
    feed_obj = Feed(feed)
    for item in feed_obj.entries:
        print ".. found file with path = '%s', item instance url = %s" % (item["entry"]["content"]["params"]["path"], item["entry"]["id"])
        
    # check if file exists
    if rass.itemExists(item["entry"]["content"]["params"]["path"]):
        # delete file from CDN
        rass.deleteItem(item["entry"]["content"]["params"]["path"])

    # check if dir exists
    if rass.dirExists("crud_test/"):
        # delete dir from CDN (recursive)
        rass.deleteDir("crud_test/", True)

except RequestError, e:
    print "Error response returned by RAWS: %s" % unicode(e)

except Exception, e:
    print "Exception occurred: %s" % unicode(e)