In [1]:
# hide ssl warnings for this example.
import requests
requests.packages.urllib3.disable_warnings()
This is a short example on how to upload container data with python-fmrest.
In [2]:
import fmrest
fms = fmrest.Server('https://10.211.55.15',
user='admin',
password='admin',
database='Contacts',
layout='Demo',
verify_ssl=False
)
fms.login()
Out[2]:
In [3]:
record_id = 1
We open a file in binary mode from the current directory and pass it to the upload_container() method.
In [4]:
with open('dog-meme.jpg', 'rb') as funny_picture:
result = fms.upload_container(record_id, 'portrait', funny_picture)
result
Out[4]:
In [5]:
record = fms.get_record(1)
record.portrait
Out[5]:
In [6]:
name, type_, length, response = fms.fetch_file(record.portrait)
name, type_, length
Out[6]:
In [7]:
from IPython.display import Image
Image(response.content)
Out[7]: