agoragames / leaderboard-python

Leaderboards backed by Redis in Python
https://github.com/agoragames/leaderboard-python
MIT License
156 stars 44 forks source link

python3: member_data is returned as type 'bytes', not a dict #31

Closed rwillmer closed 9 years ago

rwillmer commented 10 years ago

Is that expected?

I haven't used member_data in python2, so don't know if this is a python3 oddity or expected

czarneckid commented 10 years ago

member_data is just a string. You could store whatever is appropriate here, e.g. JSON.

rwillmer commented 10 years ago

The only example I can find how it's used shows it being stored as a dict, not a string.

Am I supposed to turn it into a string before saving it with .rank_member?

czarneckid commented 10 years ago

Sure, a more appropriate string like JSON is probably what you want if you're looking to store anything complex.

czarneckid commented 9 years ago

A similar discussion with @GraylinKim came up yesterday that might be related. I think you'll want to use your connection with the decode_responses argument set to True.

See also: https://github.com/andymccurdy/redis-py/blob/bc98cae7c015eba278d9f198240d0ad31f6713b8/CHANGES#L239-L241

czarneckid commented 9 years ago

@rwillmer Let me know if more clarification is needed.