Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to v3 #6

Closed
RobertMyles opened this issue May 30, 2020 · 5 comments
Closed

Update to v3 #6

RobertMyles opened this issue May 30, 2020 · 5 comments

Comments

@RobertMyles
Copy link
Owner

No description provided.

@RobertMyles
Copy link
Owner Author

Seems there is an API issue. Running the code from the site examples gives me:

GET("http://www.cepaberto.com/api/v3/address?estado=SP&cidade=Ubatuba",
  add_headers(Authorization = auth)) %>% 
  content("parsed")

Result:

named list()

This is not an R issue. Copying directly from the site:

import requests

url = "http://www.cepaberto.com/api/v3/address"
headers = {'Authorization': 'Token token=XXXXXXXXXX'}
params = {'estado': 'SP', 'cidade': 'Ubatuba'}
response = requests.get(url, headers=headers, params=params)
print(response.json())

Result:

{}

@RobertMyles
Copy link
Owner Author

@edumucelli do we need lat & lng for estado/cidade requests, Eduardo?

GET("http://www.cepaberto.com/api/v3/nearest?cidade=Ubatuba&estado=SP", add_headers(Authorization = auth)) %>% content("parsed")
$message
[1] "Atributos \"lat\" e \"lng\" necessários"

@edumucelli
Copy link
Collaborator

edumucelli commented Jun 1, 2020

nearest only takes lat and lng. The semantic behind it is that it will find the nearby CEPs from a point centered on this very coordinate formed by the lat and lng.

I could indeed make it accept a cidade and estado but I have not thought about it beforehand.

@RobertMyles
Copy link
Owner Author

Ah, understood, my mistake, I was confusing it with the cidade/estado request.

@RobertMyles
Copy link
Owner Author

Closing, CRAN submission underway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants