# LearnFetch
**LearnFetch** is a Python library designed to search and extract data from the 'Toda Materia' website. It is useful for accessing information from articles and educational content programmatically.
## Installation
To install LearnFetch, use `pip`. Make sure you have Python 3.12.3 or higher installed.
```python
pip install LearnFetch
```
## Usage
### Importing the Library
To get started with the library, import the `Pesquisador` class:
```python
from learnfetch import Pesquisador
```
### Creating an Instance and Performing a Search
Create an instance of the `Pesquisador` class and use the `get_response` method to perform searches:
```python
# Creating an instance of the Pesquisador class
researcher = Pesquisador()
# Performing a search
results = researcher.get_response("Photosynthesis")
# Displaying the results
print(results)
```
### Package Structure
The package structure includes:
- **`learnfetch/`**: Directory containing the package with the `pesquisador.py` module.
- **`__init__.py`**: File that makes the directory a Python package.
- **`pesquisador.py`**: Contains the `Pesquisador` class with methods for searching and extracting data.
- **`tests/`**: Directory for unit tests.
- **`__init__.py`**: File that makes the directory a Python package.
- **`test_pesquisador.py`**: File containing tests for the `Pesquisador` class.
## Complete Example
Here is a complete example of using the library:
```python
from learnfetch import Pesquisador
# Criando uma instância da classe Pesquisador
pesquisador = Pesquisador()
# Realizando uma busca
resultados = pesquisador.get_response("Redes neurais")
# Pegando um determinado dicionário da lista (por exemplo, o segundo)
if len(resultados) > 1:
segundo_dicionario = resultados[1]
# Pegando um valor especÃfico dentro de um dicionário
conteudo = segundo_dicionario.get("content")
print("Conteudo do Segundo Dicionário:")
print(conteudo)
```
# Another
```python
from learnfetch import Pesquisador
# O uso de docx é opcional, estou usando somente para desmostrar umas das utilidades da biblioteca
from docx import Document
# Criar uma instância da classe Pesquisador
researcher = Pesquisador()
# Realizar uma busca
termo_de_busca = "FotossÃntese"
resultados = researcher.get_response(termo_de_busca)
# Função para criar uma ficha de leitura para cada item
def adicionar_ficha_ao_documento(doc, titulo, conteudo):
doc.add_heading('Ficha de Leitura', level=1)
doc.add_heading('TÃtulo:', level=2)
doc.add_paragraph(titulo)
doc.add_heading('Resumo:', level=2)
doc.add_paragraph(conteudo)
doc.add_heading('Comentários:', level=2)
doc.add_paragraph('Adicione aqui suas observações pessoais.')
doc.add_heading('Questões levantadas:', level=2)
doc.add_paragraph('Liste aqui as questões ou dúvidas surgidas durante a leitura.')
doc.add_paragraph("\n" + "="*50 + "\n")
# Criar um documento Word
documento = Document()
# Verificar se a chave 'results' está presente no dicionário retornado
if resultados:
# Iterar sobre cada item na lista de resultados
for item in resultados:
titulo = item.get('title', 'TÃtulo não encontrado')
conteudo = item.get('content', 'Conteúdo não encontrado')
adicionar_ficha_ao_documento(documento, titulo, conteudo)
else:
print("Nenhum resultado encontrado.")
# Salvar o documento
nome_arquivo = f'ficha sobre {termo_de_busca}.docx'
documento.save(nome_arquivo)
print(f"As fichas de leitura foram salvas no arquivo {nome_arquivo}.")
```
## Contributing
If you would like to contribute to the project, feel free to open an issue or submit a pull request on the [GitHub repository](https://github.com/SaideOmaer1240/LearnFetch).
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## Contact
For any questions or suggestions, you can reach out to:
- **Author**: Saide Omar Saide
- **Email**: saideomarsaideleon@gmail.com
### Explanation of Sections:
1. **Introduction**: Describes the purpose of the library.
2. **Installation**: Instructions for installing the library using pip.
3. **Usage**: Examples of how to import, create an instance, and use the library.
4. **Package Structure**: Explains the structure of the package directories and files.
5. **Complete Example**: A detailed example of how to use the library.
6. **Contributing**: Information on how to contribute to the project.
7. **License**: Details about the project license.
8. **Contact**: Contact information for support and suggestions.
Make sure to adjust the content as needed to reflect the specifics of your project.
Raw data
{
"_id": null,
"home_page": "https://github.com/SaideOmaer1240/LearnFetch.git",
"name": "LearnFetch",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12.3",
"maintainer_email": null,
"keywords": null,
"author": "Sa\u00edde Omar Sa\u00edde",
"author_email": "saideomarsaideleon@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/61/63/5df47de5c8b9ab5ba11ecd58d443eeeb45c1fd917570dc742eca6fe5071f/learnfetch-1.0.1.tar.gz",
"platform": null,
"description": " \r\n# LearnFetch\r\n\r\n**LearnFetch** is a Python library designed to search and extract data from the 'Toda Materia' website. It is useful for accessing information from articles and educational content programmatically.\r\n\r\n## Installation\r\n\r\nTo install LearnFetch, use `pip`. Make sure you have Python 3.12.3 or higher installed.\r\n```python\r\npip install LearnFetch\r\n```\r\n## Usage\r\n\r\n### Importing the Library\r\n\r\nTo get started with the library, import the `Pesquisador` class:\r\n\r\n```python\r\nfrom learnfetch import Pesquisador\r\n```\r\n\r\n### Creating an Instance and Performing a Search\r\n\r\nCreate an instance of the `Pesquisador` class and use the `get_response` method to perform searches:\r\n\r\n```python\r\n# Creating an instance of the Pesquisador class\r\nresearcher = Pesquisador()\r\n\r\n# Performing a search\r\nresults = researcher.get_response(\"Photosynthesis\")\r\n\r\n# Displaying the results\r\nprint(results)\r\n```\r\n\r\n### Package Structure\r\n\r\nThe package structure includes:\r\n\r\n- **`learnfetch/`**: Directory containing the package with the `pesquisador.py` module.\r\n - **`__init__.py`**: File that makes the directory a Python package.\r\n - **`pesquisador.py`**: Contains the `Pesquisador` class with methods for searching and extracting data.\r\n\r\n- **`tests/`**: Directory for unit tests.\r\n - **`__init__.py`**: File that makes the directory a Python package.\r\n - **`test_pesquisador.py`**: File containing tests for the `Pesquisador` class.\r\n\r\n## Complete Example\r\n\r\nHere is a complete example of using the library:\r\n\r\n```python\r\nfrom learnfetch import Pesquisador\r\n\r\n# Criando uma inst\u00c3\u00a2ncia da classe Pesquisador\r\npesquisador = Pesquisador()\r\n\r\n# Realizando uma busca\r\nresultados = pesquisador.get_response(\"Redes neurais\")\r\n\r\n# Pegando um determinado dicion\u00c3\u00a1rio da lista (por exemplo, o segundo)\r\nif len(resultados) > 1:\r\n segundo_dicionario = resultados[1] \r\n\r\n # Pegando um valor espec\u00c3\u00adfico dentro de um dicion\u00c3\u00a1rio\r\n conteudo = segundo_dicionario.get(\"content\")\r\n print(\"Conteudo do Segundo Dicion\u00c3\u00a1rio:\")\r\n print(conteudo)\r\n```\r\n# Another\r\n```python\r\n from learnfetch import Pesquisador\r\n # O uso de docx \u00c3\u00a9 opcional, estou usando somente para desmostrar umas das utilidades da biblioteca\r\n from docx import Document\r\n\r\n # Criar uma inst\u00c3\u00a2ncia da classe Pesquisador\r\n researcher = Pesquisador()\r\n\r\n # Realizar uma busca\r\n termo_de_busca = \"Fotoss\u00c3\u00adntese\"\r\n resultados = researcher.get_response(termo_de_busca)\r\n\r\n # Fun\u00c3\u00a7\u00c3\u00a3o para criar uma ficha de leitura para cada item\r\n def adicionar_ficha_ao_documento(doc, titulo, conteudo):\r\n doc.add_heading('Ficha de Leitura', level=1)\r\n doc.add_heading('T\u00c3\u00adtulo:', level=2)\r\n doc.add_paragraph(titulo)\r\n doc.add_heading('Resumo:', level=2)\r\n doc.add_paragraph(conteudo)\r\n doc.add_heading('Coment\u00c3\u00a1rios:', level=2)\r\n doc.add_paragraph('Adicione aqui suas observa\u00c3\u00a7\u00c3\u00b5es pessoais.')\r\n doc.add_heading('Quest\u00c3\u00b5es levantadas:', level=2)\r\n doc.add_paragraph('Liste aqui as quest\u00c3\u00b5es ou d\u00c3\u00bavidas surgidas durante a leitura.')\r\n doc.add_paragraph(\"\\n\" + \"=\"*50 + \"\\n\")\r\n\r\n # Criar um documento Word\r\n documento = Document()\r\n\r\n # Verificar se a chave 'results' est\u00c3\u00a1 presente no dicion\u00c3\u00a1rio retornado\r\n if resultados:\r\n # Iterar sobre cada item na lista de resultados\r\n for item in resultados:\r\n titulo = item.get('title', 'T\u00c3\u00adtulo n\u00c3\u00a3o encontrado')\r\n conteudo = item.get('content', 'Conte\u00c3\u00bado n\u00c3\u00a3o encontrado')\r\n adicionar_ficha_ao_documento(documento, titulo, conteudo)\r\n else:\r\n print(\"Nenhum resultado encontrado.\")\r\n\r\n # Salvar o documento\r\n nome_arquivo = f'ficha sobre {termo_de_busca}.docx'\r\n documento.save(nome_arquivo)\r\n print(f\"As fichas de leitura foram salvas no arquivo {nome_arquivo}.\")\r\n```\r\n## Contributing\r\n\r\nIf you would like to contribute to the project, feel free to open an issue or submit a pull request on the [GitHub repository](https://github.com/SaideOmaer1240/LearnFetch).\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n\r\n## Contact\r\n\r\nFor any questions or suggestions, you can reach out to:\r\n\r\n- **Author**: Saide Omar Saide\r\n- **Email**: saideomarsaideleon@gmail.com\r\n \r\n\r\n### Explanation of Sections:\r\n\r\n1. **Introduction**: Describes the purpose of the library.\r\n2. **Installation**: Instructions for installing the library using pip.\r\n3. **Usage**: Examples of how to import, create an instance, and use the library.\r\n4. **Package Structure**: Explains the structure of the package directories and files.\r\n5. **Complete Example**: A detailed example of how to use the library.\r\n6. **Contributing**: Information on how to contribute to the project.\r\n7. **License**: Details about the project license.\r\n8. **Contact**: Contact information for support and suggestions.\r\n\r\nMake sure to adjust the content as needed to reflect the specifics of your project.\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Uma biblioteca para buscar e extrair dados do site 'Toda Mat\u00e9ria'.",
"version": "1.0.1",
"project_urls": {
"Homepage": "https://github.com/SaideOmaer1240/LearnFetch.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7749059b1656868f9e8245d560cca993689df9fc21c3df63ce3d4666fd760217",
"md5": "1c8e4005cccd4ef73676a5cb8cf6ccf1",
"sha256": "8e8d07c669b04258d6ecfbd6280644d185cdb97d077943e44aa853ff39b0ac66"
},
"downloads": -1,
"filename": "LearnFetch-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1c8e4005cccd4ef73676a5cb8cf6ccf1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12.3",
"size": 5233,
"upload_time": "2024-08-18T08:41:20",
"upload_time_iso_8601": "2024-08-18T08:41:20.633009Z",
"url": "https://files.pythonhosted.org/packages/77/49/059b1656868f9e8245d560cca993689df9fc21c3df63ce3d4666fd760217/LearnFetch-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "61635df47de5c8b9ab5ba11ecd58d443eeeb45c1fd917570dc742eca6fe5071f",
"md5": "d51c1900db6894bb5e418c91222b2008",
"sha256": "67469ab807bd8baab1a76c049fe74bbe934c67152083eef77ca362e41e3eb635"
},
"downloads": -1,
"filename": "learnfetch-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "d51c1900db6894bb5e418c91222b2008",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12.3",
"size": 5283,
"upload_time": "2024-08-18T08:41:23",
"upload_time_iso_8601": "2024-08-18T08:41:23.097455Z",
"url": "https://files.pythonhosted.org/packages/61/63/5df47de5c8b9ab5ba11ecd58d443eeeb45c1fd917570dc742eca6fe5071f/learnfetch-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-18 08:41:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "SaideOmaer1240",
"github_project": "LearnFetch",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "learnfetch"
}