The up42 class is the base library module imported to Python. It provides the elementary functionality that isn’t bound to a specific class of the UP42 structure.
The authenticate()
function allows you to access UP42 SDK requests.
Argument | Overview |
---|---|
cfg_file | Union[str, Path] The file path to the JSON file containing the username and password. |
username | str The email address used for logging into the console. |
password | str The password used for logging into the console. |
Examples with authenticate()
Python
# Authenticate directly in the code
up42.authenticate(
username="<your-email-address>",
password="<your-password>",
)
# Authenticate in a configuration file
up42.authenticate(cfg_file="config.json")
The tools.settings()
function allows you to enable logging.
Argument | Overview |
---|---|
log | bool Determines logging enabling:
True . |
An example with tools.settings()
Python
up42.tools.settings(log=True)
The get_credits_balance()
function returns your account balance, in credits. The returned data type is dict
.
An example with get_credits_balance()
Python
up42.get_credits_balance()
The get_example_aoi()
function returns an example AOI. The returned data type is Union[dict, GeoDataFrame]
.
Argument | Overview |
---|---|
location | str A defined location. The allowed values are as follows:
Berlin . |
as_dataframe | bool Determines how to return the information:
False . |
An example with get_example_aoi()
Python
up42.get_example_aoi(
location="Washington",
as_dataframe=True,
)
The read_vector_file()
function allows you to upload your geometry from a vector file. The returned data type is Union[dict, GeoDataFrame]
.
Argument | Overview |
---|---|
filename | str The file path to the vector file containing the geometry. The default value is aoi.geojson . |
as_dataframe | bool Determines how to return the information:
False . |
An example with read_vector_file()
Python
up42.read_vector_file(
filename="/Users/max.mustermann/Desktop/aoi.geojson",
as_dataframe=True,
)
The get_webhook_events()
function returns all available webhook events. The returned data type is dict
.
An example with get_webhook_events()
Python
up42.get_webhook_events()
The create_webhook()
function allows you to register a new webhook in the system. The returned data type is Webhook
.
Argument | Overview |
---|---|
name | str / required The name of the webhook. |
url | str / required The URL of the webhook. |
events | list[str] / required A list of events that trigger the webhook. The allowed value is order.status . |
active | bool Whether this webhook should be active after the update:
False . |
secret | str The secret used to generate webhook signatures. |
An example with create_webhook()
Python
up42.create_webhook(
name="new-webhook",
url="https://receiving-url.com",
events=["order.status"],
active=True,
secret="QWZTFnMEXhqZKNmu",
)
The get_webhooks()
function returns all registered webhooks for this workspace. The returned data type is list[Webhook]
.
Argument | Overview |
---|---|
return_json | bool Determines how to return webhooks:
False . |
An example with get_webhooks()
Python
up42.get_webhooks(return_json=False)