mediachain / oldchain-client

[DEPRECATED] old mediachain client experiments
MIT License
4 stars 2 forks source link

add datastore_get command to dump values from the datastore by key #73

Closed yusefnapora closed 8 years ago

yusefnapora commented 8 years ago

adds a datastore_get subcommand that accepts a multihash key and dumps the result to the console. Tries to use the reader.utils.dump command for nice formatted output and falls back to print if that fails.

usage:

mediachain datastore_get QmTpZY7asg9uMyYVqhKWhyopEnHJXVceCpLWK462fyQhGA

Would like to have called it datastore-get but the add_parser command doesn't have a nice way to rename the dash to an underscore, and the dash would result in an invalid python attribute name. This seemed like the simplest way to go.

vyzo commented 8 years ago

:+1:

parkan commented 8 years ago

Overall good, though some of the things I want to dump are not objects

yusefnapora commented 8 years ago

It works for the raw json blobs, since it falls back to print(str(obj)) if the object dump fails. I haven't tried it on a thumbnail yet tho. I'm guessing that it will work for python 2, since str and bytes are equivalent. Although you'd have to redirect the console output to a file to save the image.