<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
<NAME> http://philadams.net

hrpg: commandline interface for http://habitrpg.com
http://github.com/philadams/hrpg
"""


from docopt import docopt


def cli():
    """HabitRPG command-line interface.

    usage:
      hrpg status
      hrpg user [<uid>]
      hrpg tasks (--habit | --daily | --todo | --reward) [<uid>]
      hrpg task <tid> [<uid>]
      hrpg
      hrpg --version

    options:
      -h --help     Show this screen.
      --version     Show version.

    Subcommands:
      status        Get status of HabitRPG service
      user          Get user <uid> status
      tasks         Get user <uid> tasks
      task          Get task <tid> details
      <none>        Get user status for this user (convenience)
    """
    args = docopt(cli.__doc__, version='hrpg version 0.0.2')


if __name__ == '__main__':
    cli()<commit_msg>implement GET /status<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
<NAME> http://philadams.net

hrpg: commandline interface for http://habitrpg.com
http://github.com/philadams/hrpg
"""


import json

import requests
from docopt import docopt
from pprint import pprint

API_URI_BASE = 'https://habitrpg.com/api/v1'


def cli():
    """HabitRPG command-line interface.

    usage:
      hrpg status
      hrpg user [<uid>]
      hrpg tasks (--habit | --daily | --todo | --reward) [<uid>]
      hrpg task <tid> [<uid>]
      hrpg
      hrpg --version

    options:
      -h --help     Show this screen.
      --version     Show version.

    Subcommands:
      status        Get status of HabitRPG service
      user          Get user <uid> status
      tasks         Get user <uid> tasks
      task          Get task <tid> details
      <none>        Get user status for this user (convenience)
    """
    args = docopt(cli.__doc__, version='hrpg version 0.0.2')

    if args['status']:
        req = requests.get(API_URI_BASE + '/status')
        if req.status_code == 200:
            res = json.loads(req.text)
            if res['status'] == 'up':
                print('Up and running! All is well.')
    elif args['user']:
        raise NotImplementedError
    elif args['tasks']:
        raise NotImplementedError
    elif args['task']:
        raise NotImplementedError


if __name__ == '__main__':
    cli()
{'fraction_non_alphanumeric': 0.12627986348122866, 'fraction_numerical': 0.005119453924914676, 'mean_word_length': 2.041504539559014, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5121582', 'n_tokens_mistral': 772, 'n_tokens_neox': 737, 'n_words': 220}