Skip to content

Commit

Permalink
Merge pull request #38 from nguaman/fix/minor-fixes-add-notebook
Browse files Browse the repository at this point in the history
fix: minor fixes and first notebook
  • Loading branch information
nguaman authored Dec 14, 2024
2 parents 8a68561 + c0a0d38 commit f164da2
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 2 deletions.
Empty file removed notebooks/.keep
Empty file.
143 changes: 143 additions & 0 deletions notebooks/tender_by_code.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: licitpy in /home/nguaman/Escritorio/dev/projects/licitpy/.venv/lib/python3.11/site-packages (0.8.1)\n",
"Requirement already satisfied: tabulate in /home/nguaman/Escritorio/dev/projects/licitpy/.venv/lib/python3.11/site-packages (0.9.0)\n",
"Requirement already satisfied: lxml<6.0.0,>=5.3.0 in /home/nguaman/Escritorio/dev/projects/licitpy/.venv/lib/python3.11/site-packages (from licitpy) (5.3.0)\n",
"Requirement already satisfied: pandas<3.0.0,>=2.2.3 in /home/nguaman/Escritorio/dev/projects/licitpy/.venv/lib/python3.11/site-packages (from licitpy) (2.2.3)\n",
"Requirement already satisfied: pydantic<3.0.0,>=2.9.2 in /home/nguaman/Escritorio/dev/projects/licitpy/.venv/lib/python3.11/site-packages (from licitpy) (2.10.3)\n",
"Requirement already satisfied: python-dateutil<3.0.0,>=2.9.0.post0 in /home/nguaman/Escritorio/dev/projects/licitpy/.venv/lib/python3.11/site-packages (from licitpy) (2.9.0.post0)\n",
"Requirement already satisfied: python-magic<0.5.0,>=0.4.27 in /home/nguaman/Escritorio/dev/projects/licitpy/.venv/lib/python3.11/site-packages (from licitpy) (0.4.27)\n",
"Requirement already satisfied: requests<3.0.0,>=2.32.3 in /home/nguaman/Escritorio/dev/projects/licitpy/.venv/lib/python3.11/site-packages (from licitpy) (2.32.3)\n",
"Requirement already satisfied: requests-cache<2.0.0,>=1.2.1 in /home/nguaman/Escritorio/dev/projects/licitpy/.venv/lib/python3.11/site-packages (from licitpy) (1.2.1)\n",
"Requirement already satisfied: tenacity<10.0.0,>=9.0.0 in /home/nguaman/Escritorio/dev/projects/licitpy/.venv/lib/python3.11/site-packages (from licitpy) (9.0.0)\n",
"Requirement already satisfied: tqdm<5.0.0,>=4.67.0 in /home/nguaman/Escritorio/dev/projects/licitpy/.venv/lib/python3.11/site-packages (from licitpy) (4.67.1)\n",
"Requirement already satisfied: numpy>=1.23.2 in /home/nguaman/Escritorio/dev/projects/licitpy/.venv/lib/python3.11/site-packages (from pandas<3.0.0,>=2.2.3->licitpy) (2.2.0)\n",
"Requirement already satisfied: pytz>=2020.1 in /home/nguaman/Escritorio/dev/projects/licitpy/.venv/lib/python3.11/site-packages (from pandas<3.0.0,>=2.2.3->licitpy) (2024.2)\n",
"Requirement already satisfied: tzdata>=2022.7 in /home/nguaman/Escritorio/dev/projects/licitpy/.venv/lib/python3.11/site-packages (from pandas<3.0.0,>=2.2.3->licitpy) (2024.2)\n",
"Requirement already satisfied: annotated-types>=0.6.0 in /home/nguaman/Escritorio/dev/projects/licitpy/.venv/lib/python3.11/site-packages (from pydantic<3.0.0,>=2.9.2->licitpy) (0.7.0)\n",
"Requirement already satisfied: pydantic-core==2.27.1 in /home/nguaman/Escritorio/dev/projects/licitpy/.venv/lib/python3.11/site-packages (from pydantic<3.0.0,>=2.9.2->licitpy) (2.27.1)\n",
"Requirement already satisfied: typing-extensions>=4.12.2 in /home/nguaman/Escritorio/dev/projects/licitpy/.venv/lib/python3.11/site-packages (from pydantic<3.0.0,>=2.9.2->licitpy) (4.12.2)\n",
"Requirement already satisfied: six>=1.5 in /home/nguaman/Escritorio/dev/projects/licitpy/.venv/lib/python3.11/site-packages (from python-dateutil<3.0.0,>=2.9.0.post0->licitpy) (1.17.0)\n",
"Requirement already satisfied: charset-normalizer<4,>=2 in /home/nguaman/Escritorio/dev/projects/licitpy/.venv/lib/python3.11/site-packages (from requests<3.0.0,>=2.32.3->licitpy) (3.4.0)\n",
"Requirement already satisfied: idna<4,>=2.5 in /home/nguaman/Escritorio/dev/projects/licitpy/.venv/lib/python3.11/site-packages (from requests<3.0.0,>=2.32.3->licitpy) (3.10)\n",
"Requirement already satisfied: urllib3<3,>=1.21.1 in /home/nguaman/Escritorio/dev/projects/licitpy/.venv/lib/python3.11/site-packages (from requests<3.0.0,>=2.32.3->licitpy) (2.2.3)\n",
"Requirement already satisfied: certifi>=2017.4.17 in /home/nguaman/Escritorio/dev/projects/licitpy/.venv/lib/python3.11/site-packages (from requests<3.0.0,>=2.32.3->licitpy) (2024.8.30)\n",
"Requirement already satisfied: attrs>=21.2 in /home/nguaman/Escritorio/dev/projects/licitpy/.venv/lib/python3.11/site-packages (from requests-cache<2.0.0,>=1.2.1->licitpy) (24.2.0)\n",
"Requirement already satisfied: cattrs>=22.2 in /home/nguaman/Escritorio/dev/projects/licitpy/.venv/lib/python3.11/site-packages (from requests-cache<2.0.0,>=1.2.1->licitpy) (24.1.2)\n",
"Requirement already satisfied: platformdirs>=2.5 in /home/nguaman/Escritorio/dev/projects/licitpy/.venv/lib/python3.11/site-packages (from requests-cache<2.0.0,>=1.2.1->licitpy) (4.3.6)\n",
"Requirement already satisfied: url-normalize>=1.4 in /home/nguaman/Escritorio/dev/projects/licitpy/.venv/lib/python3.11/site-packages (from requests-cache<2.0.0,>=1.2.1->licitpy) (1.4.3)\n",
"Note: you may need to restart the kernel to use updated packages.\n"
]
}
],
"source": [
"%pip install licitpy tabulate"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.8.1\n"
]
}
],
"source": [
"import licitpy\n",
"print(licitpy.__version__)\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"licitpy = licitpy.Licitpy()\n",
"tender = licitpy.tenders.from_code(\"2446-900-L124\")"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"+--------------+-----------------------------------------------------------------------------------------------------------+\n",
"| Field | Value |\n",
"+==============+===========================================================================================================+\n",
"| url | https://www.mercadopublico.cl/Procurement/Modules/RFB/DetailsAcquisition.aspx?qs=0AP9GbyUyyoqNYGyeIx2+w== |\n",
"+--------------+-----------------------------------------------------------------------------------------------------------+\n",
"| code | 2446-900-L124 |\n",
"+--------------+-----------------------------------------------------------------------------------------------------------+\n",
"| title | ADQUISICIÓN DE MATERIALES PARA REPARACIÓN DE LA DEPENDENCIA DE LA CRUZ DEL III MILENIO |\n",
"+--------------+-----------------------------------------------------------------------------------------------------------+\n",
"| status | Status.CLOSED |\n",
"+--------------+-----------------------------------------------------------------------------------------------------------+\n",
"| opening_date | 2024-12-02 15:17:15-03:00 |\n",
"+--------------+-----------------------------------------------------------------------------------------------------------+\n",
"| closing_date | 2024-12-09 15:06:00-03:00 |\n",
"+--------------+-----------------------------------------------------------------------------------------------------------+\n",
"| region | Region.IV |\n",
"+--------------+-----------------------------------------------------------------------------------------------------------+\n"
]
}
],
"source": [
"from tabulate import tabulate\n",
"\n",
"data = {\n",
" \"url\": tender.url,\n",
" \"code\": tender.code,\n",
" \"title\": tender.title,\n",
" \"status\": tender.status,\n",
" \"opening_date\": tender.opening_date,\n",
" \"closing_date\": tender.closing_date,\n",
" \"region\": tender.region,\n",
"}\n",
"\n",
"table = tabulate(data.items(), headers=[\"Field\", \"Value\"], tablefmt=\"grid\")\n",
"\n",
"print(table)"
]
}
],
"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.11.11"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
2 changes: 1 addition & 1 deletion src/licitpy/entities/tender.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from datetime import date, datetime
from datetime import datetime
from typing import List, Optional

from pydantic import HttpUrl
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/test_parsers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from datetime import datetime
from zoneinfo import ZoneInfo

import pytest
import requests

Expand Down Expand Up @@ -76,7 +77,7 @@ def test_closing_date_from_ocds(
def test_closing_date_with_eligibility_closing_date(
tender_parser: TenderParser, tender_url_with_eligibility_closing_date: str
) -> None:

response = requests.get(tender_url_with_eligibility_closing_date)

assert (
Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def test_url_status() -> None:
response.status_code == 200
), f"Expected status 200, got {response.status_code}"


@pytest.mark.integration
def test_url_api_ocds() -> None:
"""
Expand Down

0 comments on commit f164da2

Please sign in to comment.