# Python BigREST ucs save and download

**URL:** <https://community.f5.com/t/python-bigrest-ucs-save-and-download/68283>\
**Category:** Community CodeShare\
**Tags:** automation, big-ip, ucs, devops, ltm, python\
**Created:** [June 1, 2021, 2:32pm UTC](https://community.f5.com/t/python-bigrest-ucs-save-and-download/68283 "2021-06-01T14:32:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sreejith](https://avatars.discourse-cdn.com/v4/letter/s/e9bcb4/32.png) [@Sreejith](https://community.f5.com/u/Sreejith)\
**Post date:** [June 1, 2021, 2:32pm UTC](https://community.f5.com/t/python-bigrest-ucs-save-and-download/68283/1 "2021-06-01T14:32:34Z")

</div>

**Problem this snippet solves:**

This uses BIGREST SDK API to save/download the ucs file.

Adding it here since I couldn’t find a similar one,

**How to use this snippet:**

Based on Python3 and BigREST ([https://bigrest.readthedocs.io](https://bigrest.readthedocs.io))

**Code :**

```auto
#Import needed libraries

from bigrest.bigip import BIGIP

import getpass

#Replace the host name as needed

host="xx.xx.xx.xx"

user=input('Username')

pw= getpass.getpass(prompt='Password:')

#Declare the ucs filename, if needed

ucsfile="test.ucs"

#Connect to device

device = BIGIP(host, user, pw)

data = {}

data["command"] = "save"

data["name"] = ucsfile

#You may get timeout exception below even if the file has been created

task = device.task_start("/mgmt/tm/sys/ucs", data)

device.task_wait(task)

if device.task_completed(task):

   device.task_result(task)

   print("Backup has been completed.")

else:

   raise Exception()

#The below will download the file to the same folder as the script

device.download("/mgmt/shared/file-transfer/ucs-downloads/", ucsfile)

```

**Tested this on version:**

13.1
