Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Rename files

  • Loading branch information...
commit 3ec538e917ed9c0216d41c703a16337180a3a454 1 parent 8a4f27e
Zach Williams authored May 27, 2012
1  README.md
Source Rendered
@@ -80,6 +80,7 @@ The `U` flag allows filtering by a specific username.
80 80
 ```bash
81 81
 hn -U zachwill
82 82
 hn ycombinator -U pg
  83
+
83 84
 hn -U pg -T submission -S points
84 85
 hn -U pg -T comment -S points asc
85 86
 ```
2  hn
@@ -4,7 +4,7 @@
4 4
 CLI for interacting with the HNSearch API.
5 5
 """
6 6
 
7  
-from newsyc import cli
  7
+from yc import cli
8 8
 
9 9
 
10 10
 def main():
8  setup.py
@@ -16,8 +16,12 @@
16 16
     author_email="hey@zachwill.com",
17 17
     url="https://github.com/zachwill/hn",
18 18
     license="MIT",
19  
-    packages=["newsyc"],
20  
-    scripts=["hn"],
  19
+    packages=[
  20
+        "yc"
  21
+    ],
  22
+    scripts=[
  23
+        "hn"
  24
+    ],
21 25
     install_requires=[
22 26
         "pygments",
23 27
         "requests",
0  newsyc/__init__.py → yc/__init__.py
File renamed without changes
6  newsyc/cli.py → yc/cli.py
@@ -5,7 +5,7 @@
5 5
 import sys
6 6
 from argparse import ArgumentParser
7 7
 import simplejson as json
8  
-from .core import YCombinator
  8
+from .core import News
9 9
 
10 10
 try:
11 11
     from pygments import highlight
@@ -32,7 +32,7 @@ def create_parser():
32 32
                         help="list of pairs to sort results")
33 33
     parser.add_argument('-T', '--type', metavar='TYPE',
34 34
                         help="type of items returned (comment or submission)")
35  
-    parser.add_argument('-U', '--username', metavar='NAME',
  35
+    parser.add_argument('-u', '-U', '--username', metavar='NAME',
36 36
                         help="filter for a specific username")
37 37
     parser.add_argument('--hits', action='store_true',
38 38
                         help="return only the number of results encountered")
@@ -65,7 +65,7 @@ def search(options):
65 65
         params['type'] = options.type
66 66
     if options.username:
67 67
         params['username'] = options.username
68  
-    data = YCombinator().get(**params)
  68
+    data = News().get(**params)
69 69
     return present(options, data)
70 70
 
71 71
 
7  newsyc/core.py → yc/core.py
@@ -6,17 +6,18 @@
6 6
 import simplejson as json
7 7
 
8 8
 from .date import Date
9  
-from .thriftdb import convert
  9
+from . import thriftdb
10 10
 
11 11
 
12  
-class YCombinator(object):
  12
+class News(object):
13 13
 
14 14
     def __init__(self):
15 15
         self.url = "http://api.thriftdb.com/api.hnsearch.com/items/_search"
16 16
 
17 17
     def get(self, **params):
18 18
         """Perform a GET request."""
19  
-        params = convert(params)
  19
+        params = thriftdb.convert(params)
  20
+        print params
20 21
         data = req.get(self.url, params=params)
21 22
         self.request = data
22 23
         return json.loads(data.content)
0  newsyc/date.py → yc/date.py
File renamed without changes
4  newsyc/thriftdb.py → yc/thriftdb.py
@@ -19,5 +19,7 @@ def convert(data):
19 19
         key = 'filter[fields][type]'
20 20
         data[key] = data.pop('type').rstrip('s')
21 21
     if 'username' in data:
22  
-        data['filter[fields][username]'] = data.pop('username')
  22
+        value = data.pop('username')
  23
+        print value
  24
+        data['filter[fields][username]'] = value
23 25
     return data

0 notes on commit 3ec538e

Please sign in to comment.
Something went wrong with that request. Please try again.