jparise / vesta

Vestaboard client library for Python
https://vesta-py.readthedocs.io
MIT License
20 stars 1 forks source link

Feature request: Return truncated rows from encoded_text instead of raising an error #114

Closed natekspencer closed 1 year ago

natekspencer commented 1 year ago

Right now, when encode_text is called with data that results in a number of rows greater than 6, a ValueError is raised. It would be nice if, instead, this could log a warning, and then return only the first 6 rows. This would be useful for truncating long song names while also trying to append a header or footer without introducing more complex logic.

jparise commented 1 year ago

The sounds like a useful change.

I might implement it by adding a new max_rows argument (which could be None for no maximum), but I'll also think about whether it's ever helpful to raise that row-related ValueError instead of just passing that responsibility on to the caller (by returning as many rows as were needed).

natekspencer commented 1 year ago

Thanks! That would be most helpful indeed!

jparise commented 1 year ago

@natekspencer #115 implements the max_rows approach and drops the ValueError. How does that look to you?

natekspencer commented 1 year ago

That looks great to me @jparise!

jparise commented 1 year ago

@natekspencer Great! I just merged it to main. If you're able to test it out, let me know if you have any feedback before I tag a new release.

natekspencer commented 1 year ago

@jparise it worked exactly like I expected it to for my use case! Thanks again!