Add Week 1 solutions - Day 1, 2, 4, 5 and Exercise
This commit is contained in:
76
week1/my-solutions/day1-solution.ipynb
Normal file
76
week1/my-solutions/day1-solution.ipynb
Normal file
@@ -0,0 +1,76 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Day 1 Solution - My Implementation\n",
|
||||
"\n",
|
||||
"This is my solution to the Day 1 assignment. I've implemented the web scraping and summarization functionality as requested.\n",
|
||||
"\n",
|
||||
"## Features Implemented:\n",
|
||||
"- Web scraping with requests and BeautifulSoup\n",
|
||||
"- SSL certificate handling for Windows\n",
|
||||
"- OpenAI API integration\n",
|
||||
"- Website content summarization\n",
|
||||
"- Markdown display formatting\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Environment setup complete!\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# My Day 1 Solution - Imports and Setup\n",
|
||||
"import os\n",
|
||||
"import ssl\n",
|
||||
"import requests\n",
|
||||
"from bs4 import BeautifulSoup\n",
|
||||
"from urllib.parse import urljoin\n",
|
||||
"from IPython.display import Markdown, display\n",
|
||||
"from openai import OpenAI\n",
|
||||
"from dotenv import load_dotenv\n",
|
||||
"\n",
|
||||
"# Load environment variables\n",
|
||||
"load_dotenv(override=True)\n",
|
||||
"\n",
|
||||
"# SSL fix for Windows\n",
|
||||
"ssl._create_default_https_context = ssl._create_unverified_context\n",
|
||||
"os.environ['PYTHONHTTPSVERIFY'] = '0'\n",
|
||||
"os.environ['CURL_CA_BUNDLE'] = ''\n",
|
||||
"\n",
|
||||
"print(\"Environment setup complete!\")\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": ".venv",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.12.12"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
||||
Reference in New Issue
Block a user