Python client of Utopian API

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@emrebeyler·
0.000 HBD
Python client of Utopian API
I use Utopian API a lot to [automate things](https://steemit.com/utopian-io/@emrebeyler/an-attempt-to-reduce-moderator-work-at-utopian-automating-accepted-posts-channel) and [gather info about the Utopian contributions](https://steemit.com/utopian-io/@emrebeyler/introducing-utopy-utopian-curation-bot) and stats. After seeing [release of the node library](https://utopian.io/utopian-io/@wehmoen/first-public-release-of-the-utopian-io-api-npm-package) 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](https://github.com/utopian-io/utopian-api-python-client) at github.

#### Installation

```
$ (sudo) pip install utopian_api
```

#### Usage

**Client instance**

```python
from utopian_api import Client
c = Client()
```

**Methods**

- Getting Moderators

```python
print(c.moderators)
```

- Check an account is a moderator?

```python
print(c.is_moderator("emrebeyler"))
```


- Getting Sponsors

```python
print(c.sponsors)
```

- Check an account is a sponsor?

```python
print(c.is_sponsor("emrebeyler"))
```

- Get approved posts

```python
print(c.posts())
```

- Get flagged posts

```python
print(c.posts({"status": "flagged"})
```

- Get contributions waiting for review on Blog category (old first)

```python
print(c.posts({"filterBy": "review", "type": "blog"}))
```

- Get count of approved contributions

```python
print(c.count())
```

- Get count of hidden contributions

```python
print(c.count({"status": "flagged"}))
```

- Get count of hidden contributions on blog posts category

```python
print(c.count({"status": "flagged", "type": "blog"}))
```

- Get post detail

```python
print(c.post("emrebeyler", "introducing-utopian-tip-a-voting-bot-votes-moderation-comments"))
```

- Get stats

```python
print(c.stats)
```

- Check Utopian.io bot is actively voting or not

```python
print(c.bot_is_voting)
```

#### Running Flow Tests

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

Let me know if you encounter any issues.

<br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@emrebeyler/python-client-of-utopian-api">Utopian.io -  Rewarding Open Source Contributors</a></em><hr/>
👍 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,