Skip to content
  • As this issue now also occurs with other OS, here a little example on how to successfully put this into a Python script:

    import requests
    requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS += 'DEFAULT:!DH' # have this before importing boto3
    
    import coscine
    import boto3
    
    # coscine api client
    with open('token_cos.txt') as f:
        TOKEN_COS: str = f.read()
    client = coscine.Client(TOKEN_COS)
    
    
    PROJECT: str = "Test Project"
    
    RESOURCE: str = "Test Resource"
        
    project = client.project(PROJECT, toplevel=False)
    resource = project.resource(RESOURCE)
    
    
    ACCESS_KEY: str = resource.s3.write_access_key
    SECRET_KEY: str = resource.s3.write_secret_key
    ENDPOINT: str = resource.s3.endpoint
    BUCKETNAME: str = resource.s3.bucket
    
    s3_client=boto3.client('s3',aws_access_key_id=ACCESS_KEY, aws_secret_access_key=SECRET_KEY, endpoint_url=ENDPOINT,)
    
    s3_client.upload_file('data.txt', BUCKETNAME, 'data.txt')
    
    Edited by Nicole Parks
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment