def create_video(): video = AdVideo(parent_id=test_config.account_id) video[AdVideo.Field.filepath] = test_config.video_path video.remote_create() video.waitUntilEncodingReady() atexit.register(remote_delete, video) return video
import os import configparser config = configparser.RawConfigParser() this_dir = os.path.dirname(__file__) config_filename = os.path.join(this_dir, 'my_app_session.cfg') with open(config_filename) as config_file: config.readfp(config_file) FacebookAdsApi.init( config.get('Authentication', 'app_id'), config.get('Authentication', 'app_secret'), config.get('Authentication', 'access_token'), ) if __name__ == '__main__': my_account = AdAccount(config.get('Defaults', 'ad_account')) # create video object video = AdVideo(parent_id=my_account.get_id_assured()) # set video fields video[AdVideo.Field.filepath] = os.path.join(this_dir, 'test_video.mp4') # remove create video.remote_create() video.waitUntilEncodingReady() print(video)
import configparser import os config = configparser.RawConfigParser() this_dir = os.path.dirname(__file__) config_filename = os.path.join(this_dir, 'my_app_session.cfg') with open(config_filename) as config_file: config.readfp(config_file) FacebookAdsApi.init( config.get('Authentication', 'app_id'), config.get('Authentication', 'app_secret'), config.get('Authentication', 'access_token'), ) if __name__ == '__main__': my_account = AdAccount('act_<AD_ACCOUNT_ID>') # create video object video = AdVideo(parent_id=my_account.get_id_assured()) # set video fields video[AdVideo.Field.filepath] = os.path.join(this_dir, 'test_video.mp4') # remove create video.remote_create() video.waitUntilEncodingReady() print(video)