tokejepsen Posted October 4, 2017 Report Share Posted October 4, 2017 Hey, How do you download a file from ftrack.server with the API? I've tried with locations, but it becomes a mess when setting up a temporary location. Link to comment Share on other sites More sharing options...
Mattias Lagergren Posted October 5, 2017 Report Share Posted October 5, 2017 Hi Toke, If you just want to download it, you can get the URL from the server location by calling get_url: server_location = session.query('Location where name is "ftrack.server"').first() url = server_location.get_url(component) # Use requests module or something else to download the file. Link to comment Share on other sites More sharing options...
tokejepsen Posted October 5, 2017 Author Report Share Posted October 5, 2017 Hey Mattias, Thanks, works Modified the code from this nice thread: https://stackoverflow.com/questions/16694907/how-to-download-large-file-in-python-with-requests-py def download_file(url, path): r = requests.get(url, stream=True) with open(path, 'wb') as f: for chunk in r.iter_content(chunk_size=1024): if chunk: f.write(chunk) if os.path.exists(path): return True else: return False Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.