Skip to content

Commit 22de64a

Browse files
committed
Update the examples to use the new client object
1 parent f903180 commit 22de64a

5 files changed

Lines changed: 9 additions & 40 deletions

File tree

examples/comment_scraper.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ def build_comments_list(client, asset_id, comment_list):
2525
Takes an initialized client, recursively builds a list of comments
2626
and returns the list. (Technically, it's a list of dicts)
2727
"""
28-
assets = client.get_asset_children(asset_id)
28+
assets = client.assets.get_children(asset_id)
2929

3030
for asset in assets:
3131
# Recurse through folders but skip the empty ones
3232
if (asset.get('type') == 'folder') and (asset.get('item_count') > 0):
3333
build_comments_list(client, asset['id'], comment_list)
3434

3535
if asset.get('type') == 'file' and asset.get('comment_count') > 0:
36-
comments = client.get_comments(asset['id'])
36+
comments = client.comments.get(asset['id'])
3737
for comment in comments:
3838
# The 'get_comments" call won't return the asset name
3939
# So we'll add it to the dictionary now.
@@ -42,9 +42,9 @@ def build_comments_list(client, asset_id, comment_list):
4242

4343
if asset.get('type') == 'version_stack':
4444
# Read about version stacks: https://docs.frame.io/docs/managing-version-stacks
45-
versions = client.get_asset_children(asset['id'])
45+
versions = client.assets.get_children(asset['id'])
4646
for v_asset in versions:
47-
comments = client.get_comments(v_asset['id'])
47+
comments = client.comments.get(v_asset['id'])
4848
for comment in comments:
4949
comment['asset'] = { 'name': asset['name'] }
5050
comment_list.append(comment)

examples/download_asset.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import os
2-
32
from frameioclient import FrameioClient
43

54
def benchmark(asset_id):
65
token = os.getenv("FRAMEIO_TOKEN")
76
client = FrameioClient(token)
8-
asset_info = client.get_asset(asset_id)
7+
asset_info = client.assets.get(asset_id)
98
accelerated_filename = client.download(asset_info, "downloads", prefix="accelerated_", multi_part=True, concurrency=20)
109

1110
# print("Normal speed: {}, Accelerated speed: {}".format(normal_speed, accelerated_speed))

examples/get_me.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
def main():
55
TOKEN = os.getenv("FRAME_IO_TOKEN")
66
client = FrameioClient(TOKEN)
7-
me = client.get_me()
7+
me = client.users.get_me()
88
print(me['id'])
99

1010
if __name__ == "__main__":

examples/new_tests.py

Lines changed: 0 additions & 20 deletions
This file was deleted.

examples/upload_asset.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
11
from frameioclient import FrameioClient
2-
import os
32

43
def main():
54
client = FrameioClient("TOKEN")
5+
file_path = './file_to_upload.mov'
6+
parent_asset_id = ''
67

7-
filesize = os.path.getsize('demo.mov')
8-
9-
asset = client.create_asset(
10-
parent_asset_id="PARENT_ASSET_ID",
11-
name="Test123.mov",
12-
type="file",
13-
filetype="video/quicktime",
14-
filesize=filesize
15-
)
16-
17-
file = open("demo.mov", "rb")
18-
client.upload(asset, file)
8+
asset = client.assets.upload(parent_asset_id,file_path)
199

2010
if __name__ == "__main__":
2111
main()

0 commit comments

Comments
 (0)