How to use the pyrfc.Connection function in pyrfc

To help you get started, we’ve selected a few pyrfc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SAP / PyRFC / material / test_server.py View on Github external
def setUpClass(cls):
        # print "Os cwd", os.getcwd()
        # print "Config", config
        ## print config._sections.items()
        cls.conn = pyrfc.Connection(**config._sections['connection'])
github SAP / PyRFC / tests / test_errors.py View on Github external
def test_no_connection_params(self):
        try:
            pyrfc.Connection()
        except pyrfc.RFCError as ex:
            assert ex.args[0] == "Connection parameters missing"
github SAP / PyRFC / tests / test_connection.py View on Github external
def test_config_parameter(self):
        # rstrip test
        conn = pyrfc.Connection(config={"rstrip": False}, **config_sections["coevi51"])
        hello = u"Hällo SAP!" + u" " * 245
        result = conn.call("STFC_CONNECTION", REQUTEXT=hello)
        # Test with rstrip=False (input length=255 char)
        assert result["ECHOTEXT"] == hello
        result = conn.call("STFC_CONNECTION", REQUTEXT=hello.rstrip())
        # Test with rstrip=False (input length=10 char)
        assert result["ECHOTEXT"] == hello
        conn.close()
        # dtime test
        conn = pyrfc.Connection(config={"dtime": True}, **config_sections["coevi51"])
        dates = conn.call("BAPI_USER_GET_DETAIL", USERNAME="demo")["LASTMODIFIED"]
        assert type(dates["MODDATE"]) is datetime.date
        assert type(dates["MODTIME"]) is datetime.time
        del conn
        conn = pyrfc.Connection(**config_sections["coevi51"])
        dates = conn.call("BAPI_USER_GET_DETAIL", USERNAME="demo")["LASTMODIFIED"]
github SAP / PyRFC / material / test_engine.py View on Github external
def test_collect(self):
        self.engine.get_user_connection(user, passwd)
        poolsize_pre = self.engine._size
        normal_conn = pyrfc.Connection(user=user, passwd=passwd, **params)
        self.engine.collect(user, normal_conn)
        self.assertEqual(poolsize_pre+1, self.engine._size)
github SAP / PyRFC / material / performance.py View on Github external
def run(COUNT):
    conn = Connection(**MME)
    result = conn.call('STFC_PERFORMANCE', **{
        'CHECKTAB': 'X', 'LGET0332': str(COUNT), 'LGET1000': str(COUNT)})
    return result
github SAP / PyRFC / material / issue40c.py View on Github external
def get_cache():
    with Connection(**connection_info) as con:
        table_cached = con.type_desc_get(table_name)
        struct_cached = con.type_desc_get(struct_name)
        return {
            table_name: vars(table_cached),
            struct_name: vars(struct_cached),
        }
github SAP / PyRFC / examples / clientStfcStructure.py View on Github external
def main():
    config = ConfigParser()
    config.read("sapnwrfc.cfg")
    params_connection = config._sections["connection"]

    conn = Connection(**params_connection)
    result = conn.call("STFC_STRUCTURE", IMPORTSTRUCT=imp)
    pprint(result)
github SAP / PyRFC / material / issue40a.py View on Github external
def invalidate():
    with pyrfc.Connection(**connection_info) as con:
        con.func_desc_remove(connection_info['sysid'], function_name)
        con.type_desc_remove(connection_info['sysid'], table_name)
        con.type_desc_remove(connection_info['sysid'], struct_name)
        # con.reset_server_context()