Merge pull request #1 from DPende/refactoring_project
Refactoring of the project
1
.env.example
Normal file
@ -0,0 +1 @@
|
||||
API_KEY="your openai.com api key"
|
||||
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
__pycache__/
|
||||
10
README.md
@ -22,13 +22,13 @@ Follow the following steps:
|
||||
3. Go to [https://openai.com](https://openai.com/) and login
|
||||
4. Now you can access to [https://platform.openai.com/docs/overview](https://platform.openai.com/docs/overview)
|
||||
5. Create a new API key and copy it
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
6. Open the .env file inside main and paste the API key
|
||||
|
||||
@ -123,4 +123,4 @@ if __name__ == "__main__":
|
||||
|
||||
Developed by
|
||||
|
||||

|
||||

|
||||
|
||||
|
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 121 KiB After Width: | Height: | Size: 121 KiB |
|
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 129 KiB After Width: | Height: | Size: 129 KiB |
@ -1,11 +1,9 @@
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
|
||||
HEADERS = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36',
|
||||
'Accept-Language': 'en-US'}
|
||||
|
||||
|
||||
def get_function(link:str, param = HEADERS) -> str:
|
||||
"""
|
||||
It sends a GET request to the specified link with optional headers.
|
||||
@ -20,9 +18,6 @@ def get_function(link:str, param = HEADERS) -> str:
|
||||
response = requests.get(url=link, headers=HEADERS)
|
||||
return str(response.content)
|
||||
|
||||
|
||||
|
||||
|
||||
def scraper(link: str, max_char: int) -> str:
|
||||
"""
|
||||
Scrapes the HTML text and removes unwanted elements, text, and comments.
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
from langchain_core.pydantic_v1 import BaseModel, Field
|
||||
|
||||
class Response(BaseModel):
|
||||
|
||||