Python client of Utopian API

I use Utopian API a lot to automate things and gather info about the Utopian contributions and stats. After seeing release of the node library for it, I have decided to do the same with Python.

It supports a good encapsulation over the HTTP api, includes a bunch of flow tests, and released under the Utopian organization at github.

Installation

$ (sudo) pip install utopian_api

Usage

Client instance

from utopian_api import Client
c = Client()

Methods

  • Getting Moderators
print(c.moderators)
  • Check an account is a moderator?
print(c.is_moderator("emrebeyler"))
  • Getting Sponsors
print(c.sponsors)
  • Check an account is a sponsor?
print(c.is_sponsor("emrebeyler"))
  • Get approved posts
print(c.posts())
  • Get flagged posts
print(c.posts({"status": "flagged"})
  • Get contributions waiting for review on Blog category (old first)
print(c.posts({"filterBy": "review", "type": "blog"}))
  • Get count of approved contributions
print(c.count())
  • Get count of hidden contributions
print(c.count({"status": "flagged"}))
  • Get count of hidden contributions on blog posts category
print(c.count({"status": "flagged", "type": "blog"}))
  • Get post detail
print(c.post("emrebeyler", "introducing-utopian-tip-a-voting-bot-votes-moderation-comments"))
  • Get stats
print(c.stats)
  • Check Utopian.io bot is actively voting or not
print(c.bot_is_voting)

Running Flow Tests

$ python flow_tests.py
.......
----------------------------------------------------------------------
Ran 7 tests in 18.916s

Let me know if you encounter any issues.



Posted on Utopian.io - Rewarding Open Source Contributors

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Logo
Center