Exemplo n.º 1
0
    def test_non_ssl_handling(self) -> None:
        """Make sure you cannot instantiate a Server with an http address."""

        with self.assertRaises(ValueError):
            fmrest.Server(url="http://127.0.0.1",
                          user=ACCOUNT_NAME,
                          password=ACCOUNT_PASS,
                          database=DATABASE,
                          layout=LAYOUT)
Exemplo n.º 2
0
    def setUp(self) -> None:

        # disable urlib warnings as we are testing with non verified certs
        requests.packages.urllib3.disable_warnings()

        self._fms = fmrest.Server(url=URL,
                                  user=ACCOUNT_NAME,
                                  password=ACCOUNT_PASS,
                                  database=DATABASE,
                                  layout=LAYOUT)
Exemplo n.º 3
0
 def test_login_data_sources(self):
     """Test login with second data source."""
     fms = fmrest.Server(url=URL,
                         user=ACCOUNT_NAME,
                         password=ACCOUNT_PASS,
                         database=DATABASE,
                         layout=LAYOUT,
                         verify_ssl=False,
                         data_sources=[
                             {'database': SECOND_DS,
                              'username': SECOND_DS_ACCOUNT_NAME,
                              'password': SECOND_DS_ACCOUNT_PASS}
                         ]
                        )
     with fms as server:
         server.login()
         record = server.get_record(1, portals=[{'name': 'secondDataSource'}])
         # read test value from second data source
         self.assertEqual(record.portal_secondDataSource[0]['secondDataSource::id'], 1)
Exemplo n.º 4
0
import fmrest
fms = fmrest.Server('https://192.168.0.171',
                    user='******',
                    password='',
                    database='FMServer_Sample',
                    layout='タスク',
                    verify_ssl=False)
fms.login()
record = fms.get_record(1)
record.name
Exemplo n.º 5
0
        file_.write(response.content)
    print(str(datetime.now()) + ' - sub-process download done.')


def determine_pause():
    # wait for a little bit before repeating the loop
    if app_testing_mode == True:
        time.sleep(app_polling_interval_testing / 1000.0)
    else:
        time.sleep(app_polling_interval / 1000.0)


# make the connection to the FMS Data API
fms = fmrest.Server(Config.get('FMS', 'url'),
                    user=Config.get('FMS', 'user'),
                    password=Config.get('FMS', 'pw'),
                    database=Config.get('FMS', 'file'),
                    layout=Config.get('FMS', 'layout'))
try:
    token = fms.login()
except Exception:
    # quit right here, no point in continuiing
    print(str(datetime.now()) + ' - Could not log into FileMaker... Stopping.')
    exit()
# print(token)

# get the app config settings
app_settings = Config['APP']
app_billy = app_settings['use']
app_testing_mode = app_settings.getboolean('testing')
app_polling_interval = app_settings.getint('polling_interval')