# e-MEC API
[![PyPI Latest Release](https://img.shields.io/pypi/v/emec-api.svg)](https://pypi.org/project/emec-api/) [![PyPI Downloads](https://img.shields.io/pypi/dm/emec-api.svg?label=PyPI%20downloads)](https://pypi.org/project/emec-api/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
[![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit)
API Python para consulta na base de dados oficial de informações relativas às Instituições de Educação Superior (e-MEC).
Essa API faz requests e parse no Html do site do e-MEC para coletar informações sobre as instituições e os cursos de cada campus.
**IMPORTANTE:** Frequentemente o site do e-MEC fica indisponível, sendo assim verifique antes de realizar muitas requisições usando a API.
[e-MEC - Ministério da Educação](http://emec.mec.gov.br/)
## Instalação
Você pode instalar o último release estável pelo [PyPI](https://pypi.python.org/pypi)
```
pip install emec-api
```
[git]: https://github.com/pavanad/emec-api "e-MEC API"
## Dependências
Para o ambiente de desenvolvimento utilize o poetry para instalar as dependências do projeto.
```bash
poetry install
```
## Como usar
Para utilizar o pacote em seu projeto importe a classe Institution e utilize conforme abaixo:
O código da instituição de ensino pode ser localizado no site do e-MEC.
```python
from emec_api.api.client import Institution
ies = Institution(22)
ies.parse()
df_inst = ies.get_institution_dataframe()
print(df_inst.head())
df_campus = ies.get_campus_dataframe()
print(df_campus.head())
df_courses = ies.get_courses_dataframe()
print(df_courses.head())
# export to json
ies.to_json("emec.json")
# export to csv
ies.to_csv("emec.csv")
```
Para utilizar a ferramenta de linha de comando veja os exemplos abaixo:
**Comandos disponíveis**
```bash
USAGE
emec [-h] [-q] [-v [<...>]] [-V] [--ansi] [--no-ansi] [-n] <command> [<arg1>] ... [<argN>]
ARGUMENTS
<command> The command to execute
<arg> The arguments of the command
GLOBAL OPTIONS
-h (--help) Display this help message
-q (--quiet) Do not output any message
-v (--verbose) Increase the verbosity of messages: "-v" for normal output, "-vv" for more
verbose output and "-vvv" for debug
-V (--version) Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n (--no-interaction) Do not ask any interactive question
AVAILABLE COMMANDS
about Shows information about emec api
help Display the manual of a command
scraper This command is used to scraper institutions data from emec.
```
Coletar dados da ies 4150 e exibir os dados no terminal
```bash
emec scraper --ies 4150
```
![](images/scraper.gif)
Coletar dados da ies 4150 e exportar para o formato padrão (JSON)
```bash
emec scraper --ies 4150 --output institution.json
```
![](images/scraper_output.gif)
Coletar dados da ies 4150 e exportar alterando o formato para CSV
```bash
emec scraper --ies 4150 --format csv --output institution.csv
```
Coletar dados de várias instituições usando o arquivo csv exportado pelo site do e-MEC
```
emec scraper --file list_institutions.csv
```
O arquivo de exemplo exportado pelo e-MEC pode ser encontrado [aqui](examples/data/list_institutions.csv)
Raw data
{
"_id": null,
"home_page": "https://github.com/pavanad/emec-api",
"name": "emec-api",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "universidades, cursos, e-mec, api, brasil",
"author": "Adilson Pavan",
"author_email": "adilson.pavan@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/33/bf/86a2f5b9b9f7679afe7682b67b6a345d5adb49a44558a387a7a95bdb6359/emec_api-0.1.10.tar.gz",
"platform": null,
"description": "# e-MEC API\n\n[![PyPI Latest Release](https://img.shields.io/pypi/v/emec-api.svg)](https://pypi.org/project/emec-api/) [![PyPI Downloads](https://img.shields.io/pypi/dm/emec-api.svg?label=PyPI%20downloads)](https://pypi.org/project/emec-api/)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)\n[![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit)\n\nAPI Python para consulta na base de dados oficial de informa\u00e7\u00f5es relativas \u00e0s Institui\u00e7\u00f5es de Educa\u00e7\u00e3o Superior (e-MEC).\n\nEssa API faz requests e parse no Html do site do e-MEC para coletar informa\u00e7\u00f5es sobre as institui\u00e7\u00f5es e os cursos de cada campus.\n\n**IMPORTANTE:** Frequentemente o site do e-MEC fica indispon\u00edvel, sendo assim verifique antes de realizar muitas requisi\u00e7\u00f5es usando a API.\n\n[e-MEC - Minist\u00e9rio da Educa\u00e7\u00e3o](http://emec.mec.gov.br/)\n\n## Instala\u00e7\u00e3o\n\nVoc\u00ea pode instalar o \u00faltimo release est\u00e1vel pelo [PyPI](https://pypi.python.org/pypi)\n\n```\npip install emec-api\n```\n\n[git]: https://github.com/pavanad/emec-api \"e-MEC API\"\n\n## Depend\u00eancias\n\nPara o ambiente de desenvolvimento utilize o poetry para instalar as depend\u00eancias do projeto.\n\n```bash\npoetry install\n```\n\n## Como usar\n\nPara utilizar o pacote em seu projeto importe a classe Institution e utilize conforme abaixo:\n\nO c\u00f3digo da institui\u00e7\u00e3o de ensino pode ser localizado no site do e-MEC.\n\n```python\nfrom emec_api.api.client import Institution\n\nies = Institution(22)\nies.parse()\n\ndf_inst = ies.get_institution_dataframe()\nprint(df_inst.head())\n\ndf_campus = ies.get_campus_dataframe()\nprint(df_campus.head())\n\ndf_courses = ies.get_courses_dataframe()\nprint(df_courses.head())\n\n# export to json\nies.to_json(\"emec.json\")\n\n# export to csv\nies.to_csv(\"emec.csv\")\n```\n\nPara utilizar a ferramenta de linha de comando veja os exemplos abaixo:\n\n**Comandos dispon\u00edveis**\n\n```bash\nUSAGE\n emec [-h] [-q] [-v\u00a0[<...>]] [-V] [--ansi] [--no-ansi] [-n] <command> [<arg1>] ... [<argN>]\n\nARGUMENTS\n <command> The command to execute\n <arg> The arguments of the command\n\nGLOBAL OPTIONS\n -h (--help) Display this help message\n -q (--quiet) Do not output any message\n -v (--verbose) Increase the verbosity of messages: \"-v\" for normal output, \"-vv\" for more\n verbose output and \"-vvv\" for debug\n -V (--version) Display this application version\n --ansi Force ANSI output\n --no-ansi Disable ANSI output\n -n (--no-interaction) Do not ask any interactive question\n\nAVAILABLE COMMANDS\n about Shows information about emec api\n help Display the manual of a command\n scraper This command is used to scraper institutions data from emec.\n```\n\nColetar dados da ies 4150 e exibir os dados no terminal\n\n```bash\nemec scraper --ies 4150\n```\n\n![](images/scraper.gif)\n\nColetar dados da ies 4150 e exportar para o formato padr\u00e3o (JSON)\n\n```bash\nemec scraper --ies 4150 --output institution.json\n```\n\n![](images/scraper_output.gif)\n\nColetar dados da ies 4150 e exportar alterando o formato para CSV\n\n```bash\nemec scraper --ies 4150 --format csv --output institution.csv\n```\n\nColetar dados de v\u00e1rias institui\u00e7\u00f5es usando o arquivo csv exportado pelo site do e-MEC\n\n```\nemec scraper --file list_institutions.csv\n```\n\nO arquivo de exemplo exportado pelo e-MEC pode ser encontrado [aqui](examples/data/list_institutions.csv)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "API Python para obter informa\u00e7\u00f5es de institui\u00e7\u00f5es de ensino superior.",
"version": "0.1.10",
"project_urls": {
"Homepage": "https://github.com/pavanad/emec-api",
"Repository": "https://github.com/pavanad/emec-api"
},
"split_keywords": [
"universidades",
" cursos",
" e-mec",
" api",
" brasil"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "26ce25d4c60ab972517003f9afffc5f8df91cf992e6afd884b36627e5d3a4606",
"md5": "0b5b6c602e58ab2d251fe383eab0e246",
"sha256": "7ec103d241cbfba3a82eb36750b29aad81cd3cb699da171368567fc63b5ed401"
},
"downloads": -1,
"filename": "emec_api-0.1.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0b5b6c602e58ab2d251fe383eab0e246",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 10281,
"upload_time": "2024-10-09T02:11:10",
"upload_time_iso_8601": "2024-10-09T02:11:10.688110Z",
"url": "https://files.pythonhosted.org/packages/26/ce/25d4c60ab972517003f9afffc5f8df91cf992e6afd884b36627e5d3a4606/emec_api-0.1.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "33bf86a2f5b9b9f7679afe7682b67b6a345d5adb49a44558a387a7a95bdb6359",
"md5": "85685fa5245920acfff8dc623183124a",
"sha256": "07c5690b62ce8009c042b650047e2fa405f530d228311f49b5352803e9160c10"
},
"downloads": -1,
"filename": "emec_api-0.1.10.tar.gz",
"has_sig": false,
"md5_digest": "85685fa5245920acfff8dc623183124a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 9470,
"upload_time": "2024-10-09T02:11:12",
"upload_time_iso_8601": "2024-10-09T02:11:12.816910Z",
"url": "https://files.pythonhosted.org/packages/33/bf/86a2f5b9b9f7679afe7682b67b6a345d5adb49a44558a387a7a95bdb6359/emec_api-0.1.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-09 02:11:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pavanad",
"github_project": "emec-api",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "emec-api"
}