def init_client():
    if len(token) < 5:
        print("Bad token, exiting test.")
        sys.exit(1)

    if environment == "PRODUCTION":
        client = FrameioClient(token)
        print("Client connection initialized.")

    else:
        client = FrameioClient(token, host='https://api.dev.frame.io')
        print("Client connection initialized.")

    return client
Exemple #2
0
    def load_client(self, project_name):
        """
        Attributes
        ----------
        project_name : str
            A string representing the name of the Frame.io project you wish to upload your files to.
        """
        client = FrameioClient(
            os.getenv("FRAMEIO_TOKEN")
        )  # This won't work unless you have a .env file with the correct token.
        me = client.get_me()
        teams = client.get_all_teams(account_id=me['account_id'])
        selected_team_id = teams.results[0]['id']
        projects = client.get_projects(
            team_id=selected_team_id
        )  # Make sure that you're selecting correct team via the index value [0] or [1]

        # Create a dict of project names and ids
        project_dict = dict()
        project_names_list = list()
        for project in projects.results:
            project_dict[project['name']] = project['id']
            project_names_list.append(project['name'])

        # Extract the matching one
        matching_name = process.extractOne(project_name, project_names_list)[0]

        print(f"Matched to project: {matching_name}")
        project_id = project_dict[
            matching_name]  # Gets relevant value for matched key
        self.project_id = project_id

        print(f"Project ID set to: {self.project_id}")
        self.client = client
Exemple #3
0
def invite_users():
    token = os.getenv('FRAMEIO_TOKEN')
    client = FrameioClient(token)

    user_list = ["*****@*****.**", "*****@*****.**"]

    client.teams.add_members('team_id', user_list)
def benchmark(asset_id):
    token = os.getenv("FRAMEIO_TOKEN")
    client = FrameioClient(token)
    asset_info = client.assets.get(asset_id)
    accelerated_filename = client.download(asset_info,
                                           "downloads",
                                           prefix="accelerated_",
                                           multi_part=True,
                                           concurrency=20)
Exemple #5
0
def manage_users():
    token = os.getenv("FRAMEIO_TOKEN")
    team_id = "35543cd2-954a-c6ee-4aa1-ce9e19602aa9"

    users_list = ["*****@*****.**", "*****@*****.**"]

    client = FrameioClient(token)
    client.teams.add_members(team_id, users_list)
    client.teams.remove_members(team_id, users_list)
Exemple #6
0
def init_client():
    if len(token) < 5:
        print("Bad token, exiting test.")
        sys.exit(1)

    client = FrameioClient(token)
    print("Client connection initialized.")

    return client
def download(asset_id):
    token = getenv("FRAME_IO_TOKEN")
    client = FrameioClient(token)
    asset_info = client.get_asset(asset_id)
    filename = client.download(asset_info,
                               "",
                               prefix="",
                               multi_part=True,
                               concurrency=8)
    return filename
Exemple #8
0
def fio_client(profile=None):
    profile = profile or fioconf.fetch("profiles", "default") or "default"
    token = fioconf.fetch(profile, "bearer_token")
    host = fioconf.fetch(profile, "host") or "https://api.frame.io"
    if "http://" in host:
        click.echo(
            "Please specify a host using HTTPS, this will not work with HTTP. Exiting..."
        )
        time.sleep(1)
        sys.exit(1)
    return FrameioClient(token, host=host)
Exemple #9
0
def main():
  client = FrameioClient("TOKEN")

  filesize = os.path.getsize('demo.mov')

  asset = client.create_asset(
    parent_asset_id="PARENT_ASSET_ID",
    name="Test123.mov",
    type="file",
    filetype="video/quicktime",
    filesize=filesize
  )

  file = open("demo.mov", "rb")
  client.upload(asset, file)
Exemple #10
0
    def __init__(self):
        """Auto executed upon instantiation"""
        super(ShotIO, self).__init__()
        #load_dotenv()
        self.location = os.path.dirname(os.path.realpath(__file__))
        self.__load_env()

        if self.__fio_token is None:
            print(
                'I was unable to get a Frame.io Token from your .env file or your environment variables'
            )
            thing = input(
                'Please paste it here or edit the .env file located at')
            self.__write_env('FRAME_IO_TOKEN', thing)
            self.__load_env()

        self.fio = FrameioClient(self.__fio_token)
        self.sg = shotgun_api3.Shotgun(self.sg_url,
                                       login=self.sg_user,
                                       password=self.__sg_pass)
def add_metadata(asset_id,metadata):
    token = getenv("FRAME_IO_TOKEN")
    client = FrameioClient(token)
    client.update_asset(asset_id, description=metadata)
def main():
    TOKEN = os.getenv("FRAME_IO_TOKEN")
    client = FrameioClient(TOKEN)
    me = client.get_me()
    print(me['id'])
def frameioclient(token):
    return FrameioClient("aaaabbbbccccddddeeee")
Exemple #14
0
    flat_comments_list = []
    for c in c_list:
        flat_comments_list.append(flatten_dict(c))

    with open('comments.csv', 'w') as file:
        f_csv = csv.DictWriter(file, headers, extrasaction='ignore')
        f_csv.writeheader()
        f_csv.writerows(flat_comments_list)


if __name__ == '__main__':

    TOKEN = os.getenv('FRAME_IO_TOKEN')
    if os.environ.get('FRAME_IO_TOKEN') == None:
        raise ClientNotTokenized(
            'The Python SDK requires a valid developer token.')
    ROOT_ASSET_ID = os.getenv('ROOT_ASSET_ID')
    if os.environ.get('ROOT_ASSET_ID') == None:
        raise RootAssetIDNotFound(
            'If you don\'t know what Root Asset ID is, read this guide: https://docs.frame.io/docs/root-asset-ids'
        )

    # Initialize the client library
    client = FrameioClient(TOKEN)

    # Build the comments list
    comments = []
    comments_list = build_comments_list(client, ROOT_ASSET_ID, comments)

    # Write the comments to comments.csv
    write_comments_csv(comments_list)
Exemple #15
0
def get_team_list(account_id):
    token = os.getenv('FRAMEIO_TOKEN')
    client = FrameioClient(token)

    return client.teams.list_all('account_id')
def main():
  client = FrameioClient("TOKEN")
  file_path = './file_to_upload.mov'
  parent_asset_id = ''

  asset = client.assets.upload(parent_asset_id,file_path)
Exemple #17
0
def setup_client():
    client = FrameioClient(token)
    return client
def main():
  client = FrameioClient("TOKEN")
  me = client.get_me()
  print(me['id'])