Skip to content

Add list of dicts support to send_batch_data #125

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

Merged
merged 5 commits into from
Jul 18, 2024

Conversation

tyeth
Copy link
Contributor

@tyeth tyeth commented Jul 16, 2024

This adds support for passing a list of dicts to send_batch_data, previously it only accepted namedtuple-like things (requiring_asdict() method). To avoid breaking people who use this uncommon method, the implementation switches on whether a list of dicts was passed, or not (namedtuples).

An example has been added to allow people to quickly test it via cpython. It generates 5 datapoints at 1second intervals in the past then batch sends and shows a url to view the feed graph/data.

Copy link

👋 Thanks for this pull request! Unfortunately, it looks like the automated continuous integration (CI) test(s) failed. These can be tricky to fix so we've written a guide on how to fix them locally. It has pages about running pre-commit locally and another about building the docs locally with sphinx. Thanks for contributing to CircuitPython! If you have more questions, feel free to join the Adafruit Discord and post in #circuitpython-dev.

@tyeth tyeth force-pushed the update_batch_send_to_take_dict branch from 12755ed to 26c459f Compare July 18, 2024 10:55
@tyeth tyeth marked this pull request as ready for review July 18, 2024 11:39
@tyeth tyeth requested a review from brentru July 18, 2024 15:27
@tyeth
Copy link
Contributor Author

tyeth commented Jul 18, 2024

@brentru this is ready for review

Copy link
Member

@brentru brentru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this implementation but really like the included example. LGTM!

@tyeth tyeth merged commit 99bd004 into main Jul 18, 2024
2 checks passed
@tyeth tyeth deleted the update_batch_send_to_take_dict branch July 18, 2024 21:02
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Jul 20, 2024
Updating https://github.com/adafruit/Adafruit_CircuitPython_AdafruitIO to 5.9.0 from 5.8.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_AdafruitIO#125 from adafruit/update_batch_send_to_take_dict
  > Merge pull request adafruit/Adafruit_CircuitPython_AdafruitIO#124 from adafruit/tyeth/issue97
  > Merge pull request adafruit/Adafruit_CircuitPython_AdafruitIO#123 from adafruit/tyeth/issue122

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Updated download stats for the libraries
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

Successfully merging this pull request may close these issues.

2 participants