In [1]:
# hide ssl warnings for this test.
import requests
requests.packages.urllib3.disable_warnings()
This is a short example on how to access data from multiple data sources.
In [2]:
import fmrest
Create the Server instance as usual, but pass a list of all databases, including credentials, you want to access during your session:
In [3]:
fms = fmrest.Server('https://10.211.55.15',
user='admin',
password='admin',
database='Contacts',
layout='Contacts',
verify_ssl=False,
data_sources=[{'database': 'SecondDataSource', 'username': 'admin2', 'password': 'admin2'}]
)
The login method obtains the access token.
In [4]:
fms.login()
Out[4]:
Now you can access records from TOs based on tables from external database files. Be it directly or via a portal.
In [5]:
record = fms.get_record(1)
record['portal_secondDataSource'][0]['SecondDataSource::name']
Out[5]:
Be nice and do your cleanup :-)
In [6]:
fms.logout()
Out[6]: