Skip to content

Commit

Permalink
Merge branch 'release/0.1.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Taranti committed May 27, 2022
2 parents 9adad7a + 7159695 commit 28c0e87
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
========================================

v0.1.3 - 2022-05-26
----------------------------------------
- Added support for disable ssl verification

v0.1.2 - 2022-05-13
----------------------------------------
- Dropped Python 3.5 support and compatibility
Expand Down
2 changes: 1 addition & 1 deletion __version__
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.2
0.1.3
2 changes: 1 addition & 1 deletion src/sidrapy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .table import get_table

VERSION = "0.1.2"
VERSION = "0.1.3"
3 changes: 2 additions & 1 deletion src/sidrapy/resources/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def get(
classifications: Dict[str, str] = None,
period: str = None,
header: str = None,
verify_ssl: bool = True,
):
url = get_url(
table_code,
Expand All @@ -69,7 +70,7 @@ def get(
header,
)

response = requests.get(url)
response = requests.get(url, verify=verify_ssl)

if not response.ok:
raise ValueError(response.text)
Expand Down
5 changes: 5 additions & 0 deletions src/sidrapy/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def get_table(
period: str = None,
header: str = None,
format: str = "pandas",
verify_ssl: bool = True,
):
"""Realiza a busca da tabela no SIDRA
Expand Down Expand Up @@ -62,6 +63,9 @@ def get_table(
- 'pandas' - Retorna uma pandas Dataframe
- 'list' - Retorna uma lista
verify_ssl : bool, optional (padrão=True)
Habilita/Desabilita a verificação ssl
Returns
-------
- list
Expand Down Expand Up @@ -130,6 +134,7 @@ def get_table(
classifications,
period,
header,
verify_ssl,
)

if format == "pandas":
Expand Down
6 changes: 4 additions & 2 deletions tests/integration/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

def test_connection():
url = sidrapy.resources.handler.ENDPOINT_BASE
r = requests.get(url, timeout=10)
r = requests.get(url, timeout=10, verify=False)
assert r.status_code == 200


def test_sample_request():
url = sidrapy.resources.handler.ENDPOINT_BASE
# api docs here: http://api.sidra.ibge.gov.br/home/ajuda
url += "/values/t/1612/p/2018/v/allxp/n1/1/d/m/h/y"
r = requests.get(url, timeout=10)
r = requests.get(url, timeout=10, verify=False)
assert r.status_code == 200
sample_response = [
{
Expand Down Expand Up @@ -118,6 +118,7 @@ def test_single_classification():
categories="39324",
period="202002",
format="list",
verify_ssl=False,
)

expected_response = [
Expand Down Expand Up @@ -185,6 +186,7 @@ def test_multiple_classification():
classifications={"11278": "33460", "166": "3067,3327"},
period="202002",
format="list",
verify_ssl=False,
)

print(data)
Expand Down

0 comments on commit 28c0e87

Please sign in to comment.