In [1]:
from IPython.display import HTML

HTML("""
<style>

/* ocultar la primera celda */
.jp-CodeCell:first-child {
    display:none;
}

/* tipografía general */
body {
    font-family: 'Segoe UI', Arial, sans-serif;
    line-height: 1.7;
    background:#fafafc;
}

/* títulos */
h1 {
    color:#6B8EEC;
    border-bottom:3px solid #BFD3FF;
    padding-bottom:6px;
}

h2 {
    color:#5A5A7A;
    margin-top:30px;
}

/* párrafos */
p {
    font-size:16px;
    color:#444;
}

/* bloques de código */
.jp-CodeCell pre {
    background:#f4f6ff !important;
    color:#333 !important;
    border-left:4px solid #9FB8FF;
    padding:12px;
    border-radius:6px;
}

/* resultados */
.jp-OutputArea pre {
    background:#fdf6ff;
    border-left:4px solid #D7B8FF;
    padding:10px;
    border-radius:6px;
}

/* tablas de pandas */
.dataframe {
    border-collapse: collapse !important;
    margin-top:15px;
    background:white;
    border-radius:8px;
    overflow:hidden;
}

.dataframe th {
    background:#C9D8FF !important;
    color:#333 !important;
    padding:8px;
}

.dataframe td {
    padding:8px;
    border-bottom:1px solid #eee;
}

/* cajas informativas */
.note {
    background:#EEF3FF;
    padding:15px;
    border-radius:8px;
    border-left:6px solid #9FB8FF;
}

/* listas */
ul {
    line-height:1.8;
}

</style>
""")
Out[1]:
In [1]:
pip install boto3
Collecting boto3
  Downloading boto3-1.42.68-py3-none-any.whl.metadata (6.7 kB)
Collecting botocore<1.43.0,>=1.42.68 (from boto3)
  Downloading botocore-1.42.68-py3-none-any.whl.metadata (5.9 kB)
Collecting jmespath<2.0.0,>=0.7.1 (from boto3)
  Downloading jmespath-1.1.0-py3-none-any.whl.metadata (7.6 kB)
Collecting s3transfer<0.17.0,>=0.16.0 (from boto3)
  Downloading s3transfer-0.16.0-py3-none-any.whl.metadata (1.7 kB)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in /home/ubuntu/venv/lib/python3.12/site-packages (from botocore<1.43.0,>=1.42.68->boto3) (2.9.0.post0)
Requirement already satisfied: urllib3!=2.2.0,<3,>=1.25.4 in /home/ubuntu/venv/lib/python3.12/site-packages (from botocore<1.43.0,>=1.42.68->boto3) (2.6.3)
Requirement already satisfied: six>=1.5 in /home/ubuntu/venv/lib/python3.12/site-packages (from python-dateutil<3.0.0,>=2.1->botocore<1.43.0,>=1.42.68->boto3) (1.17.0)
Downloading boto3-1.42.68-py3-none-any.whl (140 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 140.6/140.6 kB 8.0 MB/s eta 0:00:00
Downloading botocore-1.42.68-py3-none-any.whl (14.7 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 14.7/14.7 MB 78.3 MB/s eta 0:00:00:00:0100:01
Downloading jmespath-1.1.0-py3-none-any.whl (20 kB)
Downloading s3transfer-0.16.0-py3-none-any.whl (86 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 86.8/86.8 kB 10.6 MB/s eta 0:00:00
Installing collected packages: jmespath, botocore, s3transfer, boto3
Successfully installed boto3-1.42.68 botocore-1.42.68 jmespath-1.1.0 s3transfer-0.16.0
Note: you may need to restart the kernel to use updated packages.
In [4]:
import os
import boto3
from botocore.exceptions import ClientError, NoCredentialsError

# Cliente S3
s3 = boto3.client("s3")

# Configuración
BUCKET_NAME = "xideralaws-curso-arthur-1"

def create_object(bucket_name: str, file_path: str, object_key: str) -> None:
    """
    Sube un archivo local a S3.
    """
    try:
        s3.upload_file(file_path, bucket_name, object_key)
        print(f"Archivo subido correctamente: {object_key}")

    except FileNotFoundError:
        print(f"El archivo no existe: {file_path}")

    except NoCredentialsError:
        print("No se encontraron credenciales AWS.")

    except ClientError as e:
        print(f"Error al subir archivo: {e}")
In [5]:
!touch file.txt

local_file = "file.txt"
s3_key = "file.txt"

create_object("xideralaws-curso-arthur-1", local_file, s3_key)
Archivo subido correctamente: file.txt
In [6]:
object_key = "file.txt"
download_path = "file_downloaded.txt"
s3.download_file(BUCKET_NAME, object_key, download_path)
In [7]:
!echo "hola mundo desde boto3" > hola.txt
In [8]:
!aws s3 cp hola.txt s3://xideralaws-curso-arthur-1/
upload: ./hola.txt to s3://xideralaws-curso-arthur-1/hola.txt     
In [9]:
bucket = "xideralaws-curso-arthur-1"
key = "hola.txt"

response = s3.get_object(Bucket=bucket, Key=key)
In [10]:
response
Out[10]:
{'ResponseMetadata': {'RequestId': 'M1HRN1Q5TASAPTCW',
  'HostId': 'hhhKRsARgnm7XNlqMb8tbLF/vD2GGhRZ+P73yXapq0Av27QBMFUPfyoA4SSvDGHneQE95V6Fr1dsWITI2tTYasQjsQdxx2JH',
  'HTTPStatusCode': 200,
  'HTTPHeaders': {'x-amz-id-2': 'hhhKRsARgnm7XNlqMb8tbLF/vD2GGhRZ+P73yXapq0Av27QBMFUPfyoA4SSvDGHneQE95V6Fr1dsWITI2tTYasQjsQdxx2JH',
   'x-amz-request-id': 'M1HRN1Q5TASAPTCW',
   'date': 'Mon, 16 Mar 2026 16:22:47 GMT',
   'last-modified': 'Mon, 16 Mar 2026 16:22:41 GMT',
   'etag': '"98776417b6746a48f4d6c36df0836298"',
   'x-amz-checksum-crc64nvme': 'Z47ZjspBiBU=',
   'x-amz-checksum-type': 'FULL_OBJECT',
   'x-amz-server-side-encryption': 'AES256',
   'accept-ranges': 'bytes',
   'content-type': 'text/plain',
   'content-length': '23',
   'server': 'AmazonS3'},
  'RetryAttempts': 0},
 'AcceptRanges': 'bytes',
 'LastModified': datetime.datetime(2026, 3, 16, 16, 22, 41, tzinfo=tzutc()),
 'ContentLength': 23,
 'ETag': '"98776417b6746a48f4d6c36df0836298"',
 'ChecksumCRC64NVME': 'Z47ZjspBiBU=',
 'ChecksumType': 'FULL_OBJECT',
 'ContentType': 'text/plain',
 'ServerSideEncryption': 'AES256',
 'Metadata': {},
 'Body': <botocore.response.StreamingBody at 0x758eba0aee30>}
In [11]:
contenido = response["Body"].read().decode("utf-8")
In [12]:
contenido
Out[12]:
'hola mundo desde boto3\n'
In [16]:
!python3 --version
Python 3.12.3
In [2]:
!pip install kaggle
Requirement already satisfied: kaggle in /home/ubuntu/venv/lib/python3.12/site-packages (2.0.0)
Requirement already satisfied: bleach in /home/ubuntu/venv/lib/python3.12/site-packages (from kaggle) (6.3.0)
Requirement already satisfied: kagglesdk<1.0,>=0.1.15 in /home/ubuntu/venv/lib/python3.12/site-packages (from kaggle) (0.1.16)
Requirement already satisfied: packaging in /home/ubuntu/venv/lib/python3.12/site-packages (from kaggle) (26.0)
Requirement already satisfied: protobuf in /home/ubuntu/venv/lib/python3.12/site-packages (from kaggle) (7.34.0)
Requirement already satisfied: python-dateutil in /home/ubuntu/venv/lib/python3.12/site-packages (from kaggle) (2.9.0.post0)
Requirement already satisfied: python-slugify in /home/ubuntu/venv/lib/python3.12/site-packages (from kaggle) (8.0.4)
Requirement already satisfied: requests in /home/ubuntu/venv/lib/python3.12/site-packages (from kaggle) (2.32.5)
Requirement already satisfied: tqdm in /home/ubuntu/venv/lib/python3.12/site-packages (from kaggle) (4.67.3)
Requirement already satisfied: urllib3>=1.15.1 in /home/ubuntu/venv/lib/python3.12/site-packages (from kaggle) (2.6.3)
Requirement already satisfied: webencodings in /home/ubuntu/venv/lib/python3.12/site-packages (from bleach->kaggle) (0.5.1)
Requirement already satisfied: six>=1.5 in /home/ubuntu/venv/lib/python3.12/site-packages (from python-dateutil->kaggle) (1.17.0)
Requirement already satisfied: text-unidecode>=1.3 in /home/ubuntu/venv/lib/python3.12/site-packages (from python-slugify->kaggle) (1.3)
Requirement already satisfied: charset_normalizer<4,>=2 in /home/ubuntu/venv/lib/python3.12/site-packages (from requests->kaggle) (3.4.5)
Requirement already satisfied: idna<4,>=2.5 in /home/ubuntu/venv/lib/python3.12/site-packages (from requests->kaggle) (3.11)
Requirement already satisfied: certifi>=2017.4.17 in /home/ubuntu/venv/lib/python3.12/site-packages (from requests->kaggle) (2026.2.25)
In [3]:
import os
os.environ["KAGGLE_API_TOKEN"] = "KGAT_11875970a86b4f36bf97e8dbdb8ad8b1"
In [4]:
!kaggle competitions list
ref                                                                              deadline             category          reward  teamCount  userHasEntered  
-------------------------------------------------------------------------------  -------------------  ---------  -------------  ---------  --------------  
https://www.kaggle.com/competitions/ai-mathematical-olympiad-progress-prize-3    2026-04-15 23:59:00  Featured   2,207,152 Usd       3130           False  
https://www.kaggle.com/competitions/passenger-screening-algorithm-challenge      2017-12-15 23:59:00  Featured   1,500,000 Usd        518           False  
https://www.kaggle.com/competitions/zillow-prize-1                               2018-01-10 15:59:00  Featured   1,200,000 Usd       3770           False  
https://www.kaggle.com/competitions/data-science-bowl-2017                       2017-04-12 23:59:00  Featured   1,000,000 Usd       1972           False  
https://www.kaggle.com/competitions/vesuvius-challenge-ink-detection             2023-06-14 23:59:00  Featured   1,000,000 Usd       1249           False  
https://www.kaggle.com/competitions/gemini-3                                     2025-12-12 23:59:00  Featured     500,000 Usd       4098           False  
https://www.kaggle.com/competitions/openai-gpt-oss-20b-red-teaming               2025-08-26 23:59:00  Featured     500,000 Usd        604           False  
https://www.kaggle.com/competitions/openai-to-z-challenge                        2025-06-29 23:59:00  Featured     500,000 Usd        225           False  
https://www.kaggle.com/competitions/llm-prompt-recovery                          2024-04-16 23:59:00  Featured     200,000 Usd       2175           False  
https://www.kaggle.com/competitions/vesuvius-challenge-surface-detection         2026-02-27 23:59:00  Research     200,000 Usd       1391           False  
https://www.kaggle.com/competitions/asl-fingerspelling                           2023-08-24 23:59:00  Research     200,000 Usd       1314           False  
https://www.kaggle.com/competitions/second-annual-data-science-bowl              2016-03-14 23:59:00  Featured     200,000 Usd        192           False  
https://www.kaggle.com/competitions/datasciencebowl                              2015-03-16 23:59:00  Featured     175,000 Usd       1049           False  
https://www.kaggle.com/competitions/data-science-bowl-2019                       2020-01-22 23:59:00  Featured     160,000 Usd       3493           False  
https://www.kaggle.com/competitions/feedback-prize-2021                          2022-03-15 23:59:00  Featured     160,000 Usd       2058           False  
https://www.kaggle.com/competitions/the-nature-conservancy-fisheries-monitoring  2017-04-12 23:59:00  Featured     150,000 Usd       2293           False  
https://www.kaggle.com/competitions/tensorflow-great-barrier-reef                2022-02-14 23:59:00  Research     150,000 Usd       2025           False  
https://www.kaggle.com/competitions/AI4Code                                      2022-11-10 23:59:00  Featured     150,000 Usd       1135           False  
https://www.kaggle.com/competitions/google-gemma-3n-hackathon                    2025-08-06 23:59:00  Featured     150,000 Usd        604           False  
https://www.kaggle.com/competitions/gemma-language-tuning                        2025-01-15 00:59:00  Analytics    150,000 Usd          0           False  
In [5]:
from kaggle.api.kaggle_api_extended import KaggleApi
 
api = KaggleApi()

api.authenticate()
 
response = api.competitions_list()
 
print("Token is valid")

print(f"Competitions found: {len(response.competitions)}")
Token is valid
Competitions found: 20
In [ ]: