denvrdata / denvrpy

Denvr Cloud SDK for Python
https://docs.denvrdata.com/docs
MIT License
0 stars 0 forks source link

Should we apply `snakecase` to response data #17

Closed rofinn closed 1 day ago

rofinn commented 3 days ago

We currently use snakecase for function names and kwargs, but we intentionally don't process the returned json dict. My initial thought was that this is technically external / independent of the language and therefore doesn't need to follow the same conventions. That being said, we are already parsing the json into a python dict, so I could be convinced otherwise.

TODO: Take a look at what boto and a couple other libraries do.

rofinn commented 3 days ago

We could also return a multi-key dict rather than make a hard decision, so either lookup works.

rofinn commented 2 days ago

Another option that mostly fits with the design decisions is to introduce a shared Response type. Rather than having a custom response class for each endpoint we could just define a wrapper around the dict.

Responsibilities:

  1. Pretty printing
  2. Schema validation
  3. Pythonic attributes access (ie: response.private_ip)
  4. Immutable raw key base access (ie: response['privateIP'])
  5. Access to underlying data (ie: response.data)