Skip to main content

origin_sdk.service.Project

Project Objects

class Project()

The Project class is a more user-friendly set of mappings around the lower level OriginSession calls.

get

def get(key: str)

Shortcut for Project.project.get()

refresh

def refresh()

Refreshes the project data.

pin

def pin()

Pins the project, if it isn't already

unpin

def unpin()

Unpins the project, if it isn't already

create_scenario

def create_scenario(scenario_opts: InputScenario) -> Scenario

Shortcut to create a scenario in this project. See OriginSession.createScenario for info on argument scenario_opts

get_scenario_by_name

def get_scenario_by_name(scenario_name: str) -> Scenario

Gets a scenario from the current project using the name instead of an ID.

NOTE: In the case of more than one scenario with the same name, the first one will be returned as ordered by the service.

get_or_create_scenario_by_name

def get_or_create_scenario_by_name(scenario_name: str,
base_scenario_id: str) -> Scenario

Either gets a scenario from this project or creates a scenario in this project with the name specified. In the case of create, requires a base_id.

NOTE: In the case of more than one scenario with the same name, the first one will be returned as ordered by the service.

Arguments:

  • scenario_name - str - The name of the scenario to look for
  • base_id - str - The ID of the scenario to use as a base in the case that the scenario doesn't exist

get_project_by_name

@staticmethod
def get_project_by_name(session: OriginSession, name: str) -> "Project"

Gets a project using the name instead of an ID.

NOTE: In the case of more than one project with the same name, the first one will be returned as ordered by the service.

get_or_create_project_by_name

@staticmethod
def get_or_create_project_by_name(session: OriginSession,
name: str,
create_config: InputProject = {},
pin_project: bool = False) -> "Project"

Either creates a project with this name, or returns the project that already exists with the same name.

NOTE: In the case of more than one project with the same name, the first one will be returned as ordered by the service.

Arguments:

  • session - OriginSession - The session to make API calls with
  • name - str - The name of the project to find/create
  • create_config - str - The configuration to use in the case where the project is being created.
  • pin_project - Optional, bool - Whether to pin the project if it's not already, defaults to False