# DataCamp

## What is DataCamp?

DataCamp is an online learning platform that allows users to build and develop programming and data science skills from browser-based development environments. DataCamp offers a wide variety of tutorials, courses, and educational resources that engage students in an interactive interface to learn about coding.

Read below to learn how to use DataCamp with Filebase.

{% hint style="success" %}

### Prerequisites:

* [x] [Sign up](https://filebase.com/signup) for a free Filebase account.&#x20;
* [x] Have your Filebase Access and Secret Keys. Learn how to view your access keys [here](https://docs.filebase.com/getting-started-guides/getting-started-guide#working-with-access-keys).
* [x] Create a Filebase Bucket. Learn how to create a bucket [here](https://docs.filebase.com/getting-started-guides/getting-started-guide#creating-and-working-with-buckets).
  {% endhint %}

### 1. [Login](https://www.datacamp.com/onboarding) to your DataCamp dashboard.

From the dashboard, select ‘Workspace’ from the top navigation menu bar.

![](/files/I805tuvg1enC6luxV4IP)

### 2. Select a workspace you’d like to connect to Filebase.

This example uses a Python-based workspace:

![](/files/mroCZMgtcxSpa4H3cpab)

### 3. Then select ‘Integrations’ from the left sidebar navigation menu.

![](/files/p9YsPsevFgf9GwHcEncQ)

### 4. Select ‘Create Integration’:

![](/files/MjZR9ZSEt3w8ve1Rolox)

### 5. Select ‘Environment Variables’:

![](/files/RQZvoMOuVZ1t7YfLgJRZ)

### 6. Enter two variables, `FILEBASE_ACCESS_KEY` and `FILEBASE_SECRET_KEY`.

For the value of these variables, enter your Filebase Access Key and Filebase Secret Key. Name this integration ‘Filebase Keys’. Then select ‘Create’.

![](/files/vzi2BlTCFRLup6oFpfsi)

### 7. Copy the provided integration code, then select ‘Next’:

![](/files/v3DLCjdVazAbKQcQQfdL)

### 8. Select ‘Connect’ when prompted to connect your workspace to your newly created integration:

![](/files/kSdpHg2snsJfv9UBhLFH)

### 9. Next, select ‘Add code’ at the bottom of your workspace to add a new piece of code.

![](/files/mRjH0FeE0PpI5FufNu4w)

### 10. To list all the buckets on your Filebase account, enter the following piece of code:

```python
import os
import boto3

filebase_access_key = os.environ["FILEBASE_ACCESS_KEY"]
filebase_secret_key = os.environ["FILEBASE_SECRET_KEY"]

s3 = boto3.client('s3',
	endpoint_url='https://s3.filebase.com',
	aws_access_key_id=filebase_access_key,
	aws_secret_access_key=filebase_secret_key)

response = s3.list_buckets()

# Output the bucket names
print('Existing buckets:')
for bucket in response['Buckets']:
    print(f'  {bucket["Name"]}')
```

### 11. Then select ‘Run’:

![](/files/EocuVsvquZWEKBGFBKm9)

Your Filebase bucket names should be returned:

![](/files/9WpdvWmsaYxcECv9WcJ2)

### 12. To create a new Filebase bucket, use the following piece of code:

```python
import os
import boto3

filebase_access_key = os.environ["FILEBASE_ACCESS_KEY"]
filebase_secret_key = os.environ["FILEBASE_SECRET_KEY"]

s3 = boto3.client('s3',
	endpoint_url='https://s3.filebase.com',
	aws_access_key_id=filebase_access_key,
	aws_secret_access_key=filebase_secret_key)

bucket_name = "new-filebase-bucket-name"

s3.create_bucket(Bucket=bucket_name)
```

### 13. Then select ‘Run’:

![](/files/xt2SBfMhpYZ9dZqMR5sk)

The response data should resemble the following, including a 200 HTTP Status Code indicating the success:

![](/files/d2TjWMuZZ95zPy7gm7wP)

### 14. To upload an object from your workspace to Filebase, use the following code:

```python
import os
import boto3

filebase_access_key = os.environ["FILEBASE_ACCESS_KEY"]
filebase_secret_key = os.environ["FILEBASE_SECRET_KEY"]

s3 = boto3.client('s3',
	endpoint_url='https://s3.filebase.com',
	aws_access_key_id=filebase_access_key,
	aws_secret_access_key=filebase_secret_key)

file_path = ""
bucket_name = "filebase-bucket-name"
key_name = "object-name"

s3.put_object(Body=file_path, Bucket=bucket_name, Key=key_name)
```

Replace `filebase-bucket-name` with your Filebase bucket name, and `object-name` with the name of the file to be uploaded.

### 15. Then select ‘Run’ to run the code:

![](/files/MtH0IdVX9Sq5FODNGkbs)

The response data should resemble the following, including a 200 HTTP Status Code indicating the success:

![](/files/lv15qxp5NZETvYMpo8cS)

### 16. You can verify that the file has been uploaded by navigating to the Filebase web console and viewing the contents of your bucket:

![](/files/RWZ026z2devJQWzLzDdM)

### 17. To download an object to your workspace, use the following code:

```python
import os
import boto3

filebase_access_key = os.environ["FILEBASE_ACCESS_KEY"]
filebase_secret_key = os.environ["FILEBASE_SECRET_KEY"]

s3 = boto3.client('s3',
	endpoint_url='https://s3.filebase.com',
	aws_access_key_id=filebase_access_key,
	aws_secret_access_key=filebase_secret_key)

bucket_name = "filebase-bucket-name"
key_name = "object-name"

s3.get_object(Bucket=bucket_name, Key=key_name)
```

Replace `filebase-bucket-name` with your Filebase bucket name, and `object-name` with the name of the file to be uploaded.

### 18. Then select ‘Run’ to run the code:

![](/files/EE6m74PkjtIabGBkV073)

The response data should resemble the following, including a 200 HTTP Status Code indicating the success:

![](/files/e8dcdJyxU4gesR2XaRFw)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.filebase.com/code-development-+-sdks/code-development/datacamp.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
