Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Parameter

Type

Description

Example

tokenstring

Your ONC API token.

Once logged in at https://data.oceannetworks.ca/login, your token can be retrieved or generated at https://data.oceannetworks.ca/Profile. Click on the "Web Services" tab, then click "Generate Token".

'YOUR_TOKEN_HERE'
productionboolean

Indicates whether the ONC Production server URL is used for service requests.

  • True: Use the production server.
  • False: Use the internal ONC test server (reserved for ONC staff IP addresses).

Default: True

True
showInfoboolean

Indicates whether verbose script messages are displayed, such as request url and processing time information.

  • True: Print all information and debug messages (intended for debugging).
  • False: Only print information messages

Default: False

True
outPathstring

When using methods that download files, the path that files are saved to (relative to the current directory).

If the path provided doesn't exist, it will be created.

Default: 'output'

'c:/ONC/Download'
timeoutint

Number of seconds before a request to the API is canceled due to a timeout.

Default: 60

30



Code Block
languagepy
themeDJango
titleExample: Create an ONC object
from onc.onc import ONC
onc = ONC('YOUR_TOKEN_HERE')



Code Block
languagepy
themeDJango
titleExample: Create an ONC object with custom configuration
from onc.onc import ONC
onc = ONC('YOUR_TOKEN_HERE', showInfo=True, outPath='C:/onc-files')


...