cottoncandy

get_browser([bucket_name, ACCESS_KEY, …])

Browser object that allows you to tab-complete your way through your objects

get_encrypted_interface([bucket_name, …])

Returns a cc interface that encrypts things By default, encryption is 32 bit AES, single key for everything.

get_interface([bucket_name, ACCESS_KEY, …])

Return an interface to the cloud.

get_browser

cottoncandy.get_browser(bucket_name='FAKE_DEFAULT_BUCKET', ACCESS_KEY='FAKE_ACCESS_KEY', SECRET_KEY='FAKE_SECRET_KEY', endpoint_url='FAKE_ENDPOINT_URL')

Browser object that allows you to tab-complete your way through your objects

Parameters
  • bucket_name (str) –

  • ACCESS_KEY (str) –

  • SECRET_KEY (str) –

  • endpoint_url (str) – The URL for the S3 gateway

Returns

ccb

Return type

cottoncandy.BrowserObject

Example

>>> browser = cc.get_browser('my_bucket',
                             ACCESS_KEY='FAKEACCESSKEYTEXT',
                             SECRET_KEY='FAKESECRETKEYTEXT',
                             endpoint_url='https://s3.amazonaws.com')
>>> browser.sweet_project.sub<TAB>
browser.sweet_project.sub01_awesome_analysis_DOT_grp
browser.sweet_project.sub02_awesome_analysis_DOT_grp
>>> browser.sweet_project.sub01_awesome_analysis_DOT_grp
<cottoncandy-group <bucket:my_bucket_name> (sub01_awesome_analysis.grp: 3 keys)>
>>> browser.sweet_project.sub01_awesome_analysis_DOT_grp.result_model01
<cottoncandy-dataset <bucket:my_bucket_name [1.00MB:shape=(10000)]>

get_encrypted_interface

cottoncandy.get_encrypted_interface(bucket_name='FAKE_DEFAULT_BUCKET', ACCESS_KEY='FAKE_ACCESS_KEY', SECRET_KEY='FAKE_SECRET_KEY', endpoint_url='FAKE_ENDPOINT_URL', force_bucket_creation=False, verbose=True, backend='s3', encryption='AES', encryptionKey=False)

Returns a cc interface that encrypts things By default, encryption is 32 bit AES, single key for everything. The key is stored in base64 in your config file. You can also choose to use RSA-encrypted AES, in which each file gets a different key, and the keys are encrypted using RSA and stored alongside each file.

Parameters
  • encryption (str) – ‘RSA’ | ‘AES’

  • encryptionKey (str) – if RSA, path to key file, if AES, binary string encryption key

get_interface

cottoncandy.get_interface(bucket_name='FAKE_DEFAULT_BUCKET', ACCESS_KEY='FAKE_ACCESS_KEY', SECRET_KEY='FAKE_SECRET_KEY', endpoint_url='FAKE_ENDPOINT_URL', force_bucket_creation=False, verbose=True, backend='s3', **kwargs)

Return an interface to the cloud.

Parameters
  • bucket_name (str) –

  • ACCESS_KEY (str) –

  • SECRET_KEY (str) –

  • endpoint_url (str) – The URL for the S3 gateway

  • backend ('s3'|'gdrive') – What backend to hook on to

  • kwargs – S3 only. kwargs passed to botocore. For example, >>> from botocore.client import Config >>> config = Config(connect_timeout=50, read_timeout=10*60) >>> cci = cc.get_interface(‘my_bucket’, config=config)

Returns

cci

Return type

cottoncandy.InterfaceObject