Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cleaned up coderwall script

Created a setup installer
Created a README.md file
  • Loading branch information...
commit 447f99628e7bda16bc1af5e4bab603f11808602d 1 parent 2f1e26e
Josh Benham authored
30 README.md
View
@@ -0,0 +1,30 @@
+coderwall
+==========
+
+[Josh Benham](http://joshbenham.net)'s CoderWall command line interface to retrieve users statistics
+[![Build Status](https://secure.travis-ci.org/joshbenham/coderwall.png?branch=master)](http://travis-ci.org/joshbenham/coderwall)
+
+Overview
+--------
+
+A simple command line tool to query users on coderwall and retrieve their statistics.
+
+Instructions
+------------
+```sh
+# grab the repo
+git clone git://github.com/joshbenham/coderwall
+
+# symlink it to your bin directory
+ln -s coderwall/coderwall_r ~/bin/coderwall
+```
+
+Also make sure that your ~/bin directory is in your environment path.
+
+Usage
+-------
+
+```sh
+# check to see what statistics joshbenham has
+coderwall joshbenham
+```
18 coderwall/cli.py
View
@@ -11,25 +11,29 @@
from clint import args
from clint.textui import colored, indent, puts
from coderwall.coderwall import CoderWall, CoderWall_UserNotFoundError
+from requests.exceptions import ConnectionError
def main():
if len(args) != 1:
- puts(_e('Usage: cw <username>'))
+ puts(_p('Usage') + _s(': ') + _p('coderwall ') + _s('<') + _p('username') + _s('>'))
sys.exit(1)
try:
coderwall = CoderWall(args.get(0))
+ except ConnectionError:
+ puts(_p('Error') + _s(': ') + _p('There seems to be a problem with the internet'))
+ sys.exit(1)
except CoderWall_UserNotFoundError:
- puts(_e('%s does not seem to be a CoderWall user' % (args.get(0))))
+ puts(_p('Error') + _s(': ') + _p('%s does not seem to be a CoderWall user' % (args.get(0))))
sys.exit(1)
user = coderwall.user
- puts(user.get('name') + _s(' (') + user.get('username') + _s('), ') + user.get('location') + _s(',') + ' Endorsed ' + _s(str(user.get('endorsements'))) + ' times')
+ puts(_p(user.get('name')) + _s(' (') + _p(user.get('username')) + _s('), ') + _p(user.get('location')) + _s(',') + _p(' Endorsed ') + _s(str(user.get('endorsements'))) + _p(' times'))
- puts('Badges' + _s(':'))
+ puts(_p('Badges') + _s(':'))
with indent(3):
for badge in user.get('badges'):
- puts('%s%s%s %s' % (_s('('), _p(badge['name']), _s(')'), badge['description']))
+ puts('%s%s%s %s' % (_s('('), _p(badge['name']), _s(')'), _p(badge['description'])))
# Color: Primary
def _p(s):
@@ -38,7 +42,3 @@ def _p(s):
# Color: Secondary
def _s(s):
return colored.cyan(s)
-
-# Color: Error
-def _e(s):
- return colored.red(s)
0  cw → coderwall_r
View
File renamed without changes
6 requirements.txt
View
@@ -0,0 +1,6 @@
+certifi==0.0.8
+chardet2==2.0.1
+clint==0.3.1
+distribute==0.6.24
+requests==0.11.1
+wsgiref==0.1.2
18 setup.py
View
@@ -0,0 +1,18 @@
+from setuptools import setup
+
+setup(name='coderwall',
+ version='0.1',
+ description='CoderWall command line interface to retrieve users statistics',
+ long_description=open('README.md').read(),
+ classifiers=[
+ "Programming Language :: Python",
+ ],
+ author="Josh Benham",
+ author_email='joshbenham@gmail.com',
+ url='https://github.com/joshbenham/coderwall',
+ keywords='web python coderwall statistics cli terminal',
+ packages=['coderwall',],
+ scripts=['coderwall_r'],
+ install_requires=open('requirements.txt').read(),
+)
+
Please sign in to comment.
Something went wrong with that request. Please try again.