def initialize(cls):
"""
This will be called the first time a toolbox of this type is created. This is meant for installing libraries if they are
needed. For example, if you need boto3 for an Amazon Handler, you would call
FloatingTools.installPackage('boto3', 'boto') here. This is also meant for any other set up such as getting login data.
.. note::
This is only called once during the first call to create a toolbox if this type.
.. code-block:: python
:linenos:
@classmethod
def initialize(cls):
# install the aws api lib through pip
FloatingTools.installPackage('boto3', 'boto')
import boto3
from botocore.client import Config
# set log in data for AWS
os.environ['AWS_ACCESS_KEY_ID'] = cls.userData()['access key']
os.environ['AWS_SECRET_ACCESS_KEY'] = cls.userData()['secret key']
cls.CONNECTION = boto3.resource('s3', config=Config(signature_version='s3v4'))
"""
pass
评论列表
文章目录