-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
4,715 additions
and
4,387 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.3.0 | ||
2.4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,8 @@ | |
|
||
from .pyrfc import ( | ||
get_nwrfclib_version, | ||
py_to_string, | ||
string_to_py, | ||
set_ini_file_directory, | ||
Connection, | ||
Throughput, | ||
|
@@ -39,6 +41,6 @@ | |
__VERSION__, | ||
) | ||
|
||
__author__: str = """"Srdjan Boskovic""" | ||
__author__: str = """"SAP SE""" | ||
__email__: str = "[email protected]" | ||
__version__: str = __VERSION__ |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
from typing import Any, Optional, Dict, TypedDict | ||
|
||
from typing import Any, Optional, Dict | ||
def get_nwrfclib_version(): tuple | ||
def set_ini_file_directory(path_name: str): None | ||
class NWRFCSDKVersion(TypedDict): | ||
major: int | ||
minor: int | ||
patchLevel: int | ||
platform: str | ||
|
||
class Connection(): | ||
version: {major: int, minor: int, patchLevel: int} | ||
def __init__(self, config: Optional[Dict] = {}, *params: Any) -> None: ... | ||
class ClientOptions(TypedDict): | ||
dtime: bool = False | ||
return_import_params: bool = False | ||
rstrip: bool = True | ||
|
||
def get_nwrfclib_version() -> NWRFCSDKVersion: ... | ||
def set_ini_file_directory(path_name: str) -> None: ... | ||
|
||
class Connection: | ||
version: NWRFCSDKVersion | ||
def __init__( | ||
self, config: ClientOptions = {"dtime": False, "return_import_params": False, "rstrip": True}, **kwargs: str | ||
) -> None: ... | ||
|
||
__VERSION__: str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from pyrfc import Connection | ||
|
||
import pickle | ||
|
||
client = Connection(dest="MME") | ||
|
||
fd = client.get_function_description("BAPI_USER_GET_DETAIL") | ||
|
||
print(fd) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,32 @@ | ||
import os | ||
from pyrfc import Server, set_ini_file_directory | ||
|
||
# server function | ||
def my_stfc_connection(request_context=None, REQUTEXT=""): | ||
print("stfc invoked"); | ||
print("request_context", request_context); | ||
print(f"REQUTEXT: {REQUTEXT}"); | ||
print("stfc invoked") | ||
print("request_context", request_context) | ||
print(f"REQUTEXT: {REQUTEXT}") | ||
|
||
return {"ECHOTEXT": REQUTEXT, "RESPTEXT": "Python server here"} | ||
|
||
return { | ||
"ECHOTEXT": REQUTEXT, | ||
"RESPTEXT": "Python server here" | ||
} | ||
|
||
def my_auth_check(func_name=False, request_context = {}): | ||
# server authorisation check | ||
def my_auth_check(func_name=False, request_context={}): | ||
print(f"authorization check for '{func_name}'") | ||
print("request_context", request_context) | ||
return 0 | ||
|
||
|
||
dir_path = os.path.dirname(os.path.realpath(__file__)) | ||
set_ini_file_directory(dir_path) | ||
|
||
# create server instance | ||
server = Server({"dest": "gateway"}, {"dest": "MME"}, {"port": 8081, "server_log": False}) | ||
# server = Server({"dest": "gateway"}, {"dest": "MME"}, {"auth_check": my_auth_check, "server_log": True}) | ||
|
||
server.add_function("STFC_CONNECTION", my_stfc_connection ) | ||
# expose python function my_stfc_connection as ABAP function STFC_CONNECTION, that ABAP server can call | ||
server.add_function("STFC_CONNECTION", my_stfc_connection) | ||
|
||
# start server | ||
server.serve() | ||
|
||
# server = Server({"dest": "gateway"}, {"dest": "MME"}, {"auth_check": my_auth_check, "server_log": True}) |