New release - utopian-cli 0.2.1

in #utopian-io7 years ago (edited)

terminal.png

I released utopian-cli yesterday, and I've been hard at work today adding some new commands, improving already existing ones and making it compatible with Python2.7.

Features overview

The "moderator" and "contributions" command were both updated slightly, and the two new commands "sponsors" and "points" were added. Everything should now also work with Python2.7 (I only tested it briefly).

I will go over all the changes one by one below! You can also check out the usage of all commands on the README (also updated for version 0.2.1).


Improved features


Moderators

I added the --j flag that allows the user to print the moderator in JSON format instead of just the moderator's name. I also added the --account option that allows the user to specify a moderator's name and only print information about that moderator

image.png

Contributions

I changed it so that it prints an actual URL you can click instead of just the title of a post. This way the user can directly go to a contribution instead of having to manually go there

image.png


New features


Sponsors

This is very similar to the moderators command. It currently has the options --account, which lets the user specify an account, and the flag --j, which lets the user print the supervisor in JSON format

image.png

Points

This command has the arguments (not options) date, which lets the user specify how far to go back when retrieving contributions, and the argument account, which lets the user specify which moderator they want to check.

What this command does is retrieve all reviewed contributions by the given moderator since the given date, so for example a week ago. It then prints information about the amount of contributions the moderator has approved / rejected, and how many points they managed to get. It also has some error checking; it makes sure the given account is actually a moderator and that the date isn't a date in the future.

utopian_points.gif

In the future I will probably add some more options to this, like e.g. checking between two given dates instead of between the current date and the given date.

When I started implementing this today I didn't know there was a way to get all posts that were reviewed by a moderator directly from the API. Because of this I started implementing this in a very hacky way, which also took ages to load. After talking to @roj (thanks for the help!) and finding out there's an actual page with some documentation for the Utopian.io API, I figured out a much better way to implement it. So I then scrapped everything I had built for the command so far and rebuilt everything from scratch, and I must say it works nicely!


How was it implemented?

Everything was implemented using the same packages as the previous version, except I needed a way to parse the date from the terminal, and for this I used the Python package dateutil.

To make it compatitible with Python2.7 all I had to do was add the following code

try:
    from urllib import urlencode
except ImportError:
    from urllib.parse import urlencode

and then change the use of urlencode(). Very simple!


Roadmap

Currently I don't have that many plans, except that I want to expand the "points" command and add new options. I think I will just check out the Utopian.io API documentation and see what pops into my mind.

How to contribute?

  1. Fork the repository
  2. Create a feature branch with git checkout -b your-feature
  3. Code and document your feature
  4. Commit your changes with git commit -m "add my features"
  5. Push to your branch with git push origin your-feature
  6. Create a new pull request

Anything you can add to the project is valuable to me, be it bug reports, suggestions etc. so please don't hesitate!



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Works like a charm! Good job!

Hey @amosbastian I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Coin Marketplace

STEEM 0.19
TRX 0.25
JST 0.037
BTC 96709.35
ETH 3340.46
USDT 1.00
SBD 3.16