Skip to content

Commit

Permalink
docs: Add example project for soap requests
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobsvante committed Jun 2, 2022
1 parent 1b2d4d6 commit 352bdd6
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions examples/soap-api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import argparse
import asyncio

from netsuite import Config
from netsuite.constants import DEFAULT_INI_PATH, DEFAULT_INI_SECTION
from netsuite.soap_api.client import NetSuiteSoapApi

parser = argparse.ArgumentParser()
parser.add_argument("-p", "--config-path", default=DEFAULT_INI_PATH, dest="path")
parser.add_argument(
"-c", "--config-section", default=DEFAULT_INI_SECTION, dest="section"
)


async def main():
args = parser.parse_args()

config = Config.from_ini(**vars(args))
api = NetSuiteSoapApi(config)

resp1 = await api.getList("customer", internalIds=[1])
print(resp1)

# Re-use same connection
async with api:
resp2 = await api.getList("salesOrder", internalIds=[1])
resp3 = await api.getList("salesOrder", internalIds=[2])

print(resp2)
print(resp3)


if __name__ == "__main__":
asyncio.run(main())

0 comments on commit 352bdd6

Please sign in to comment.