Permalink
Browse files

Rename files

  • Loading branch information...
1 parent 8a4f27e commit 3ec538e917ed9c0216d41c703a16337180a3a454 @zachwill committed May 28, 2012
View
@@ -80,6 +80,7 @@ The `U` flag allows filtering by a specific username.
```bash
hn -U zachwill
hn ycombinator -U pg
+
hn -U pg -T submission -S points
hn -U pg -T comment -S points asc
```
View
2 hn
@@ -4,7 +4,7 @@
CLI for interacting with the HNSearch API.
"""
-from newsyc import cli
+from yc import cli
def main():
View
@@ -16,8 +16,12 @@
author_email="hey@zachwill.com",
url="https://github.com/zachwill/hn",
license="MIT",
- packages=["newsyc"],
- scripts=["hn"],
+ packages=[
+ "yc"
+ ],
+ scripts=[
+ "hn"
+ ],
install_requires=[
"pygments",
"requests",
File renamed without changes.
@@ -5,7 +5,7 @@
import sys
from argparse import ArgumentParser
import simplejson as json
-from .core import YCombinator
+from .core import News
try:
from pygments import highlight
@@ -32,7 +32,7 @@ def create_parser():
help="list of pairs to sort results")
parser.add_argument('-T', '--type', metavar='TYPE',
help="type of items returned (comment or submission)")
- parser.add_argument('-U', '--username', metavar='NAME',
+ parser.add_argument('-u', '-U', '--username', metavar='NAME',
help="filter for a specific username")
parser.add_argument('--hits', action='store_true',
help="return only the number of results encountered")
@@ -65,7 +65,7 @@ def search(options):
params['type'] = options.type
if options.username:
params['username'] = options.username
- data = YCombinator().get(**params)
+ data = News().get(**params)
return present(options, data)
@@ -6,17 +6,18 @@
import simplejson as json
from .date import Date
-from .thriftdb import convert
+from . import thriftdb
-class YCombinator(object):
+class News(object):
def __init__(self):
self.url = "http://api.thriftdb.com/api.hnsearch.com/items/_search"
def get(self, **params):
"""Perform a GET request."""
- params = convert(params)
+ params = thriftdb.convert(params)
+ print params
data = req.get(self.url, params=params)
self.request = data
return json.loads(data.content)
File renamed without changes.
@@ -19,5 +19,7 @@ def convert(data):
key = 'filter[fields][type]'
data[key] = data.pop('type').rstrip('s')
if 'username' in data:
- data['filter[fields][username]'] = data.pop('username')
+ value = data.pop('username')
+ print value
+ data['filter[fields][username]'] = value
return data

0 comments on commit 3ec538e

Please sign in to comment.