Edge Session
The EdgeSession
class is your entry point into the Edge API. For example,
if you have an EdgeSession instance called mysession
, then the Files API is
available at mysession.files
. Likewise for data sources (.sources
), and
even publishing applications(.applications
).
Constructing an EdgeSession
In order to construct an EdgeSession object, you need three pieces of information:
- An Edge API token. You can create one of in the "Edge API Tokens" section of your Profile.
- The URL to the Edge API. For the main Edge server at
edge.enthought.com, this is
https://edge.enthought.com/services/api
. - The name of the organization in Edge to which you want to connect. This is
the "short name" that shows up in the URL, for example,
default
.
Auto-configuration
The EdgeSession object will automatically look for these environment variables, and use them to construct the object:
- EDGE_API_TOKEN or JUPYTERHUB_API_TOKEN
- EDGE_API_SERVICE_URL
- EDGE_API_ORG
If these are present, simply call the constructor with no arguments:
from edge.api import EdgeSession
mysession = EdgeSession()
Programmatic configuration
If you wish to configure an EdgeSession without using environment variables, pass the three parameters from your code. We recommend using the keyword names in case the order of arguments shifts at some point in the future:
from edge.api import EdgeSession
mysession = EdgeSession(api_token=mytoken,
service_url="https://edge.enthought.com/services/api",
organization="default")
Edge utilizes the standard Python requests library under the hood, simplifying
the process of working with proxy servers. To enable your EdgeSession
to
function seamlessly on a local setup with proxy protections, you only need to
configure two variables in your Python environment:
HTTP_PROXY
HTTPS_PROXY
Your IT administrator or the individual responsible for your lab's networking can provide this information for you. For more on this, you can review the documentation for the requests library.
EdgeSession Reference
Constructor
EdgeSession(api_token=None, service_url=None, organization=None)
Be sure to use keyword arguments when calling the constructor, not positional arguments. The order of parameters may change at some point in the future.
Parameters
- api_token (str)
Your Edge API token. - service_url (str)
URL (including https://) of the Edge API - organization (str)
"Short name" of your Edge org, for example, "default"
Properties
organization
Property (str). The name of the organization to which this EdgeSession is attached.
files
Property (Folder). A Folder
instance at the root of the Edge file system.
sources
Property (EdgeData). An EdgeData
instance with access to data connectors.
applications
Property (EdgeApplication). An interface for managing applications and application versions.
Methods
whoami
whoami() -> WhoAmI
Returns
WhoAmI object.