diff --git a/foaas.py b/foaas.py index 10374b6..8ae8c69 100644 --- a/foaas.py +++ b/foaas.py @@ -14,6 +14,7 @@ class FuckingResponse(object): ''' Takes care of making the actual request in the specified format. ''' + def __init__(self, url, language=None): self.url = url self.language = language @@ -49,38 +50,86 @@ def html(self): class Fuck(object): actions = { + 'anyway': 'anyway/{company}/{from}', + 'asshole': 'asshole/{from}', 'awesome': 'awesome/{from}', + 'back': 'back/{name}/{from}', + 'bag': 'bag/{from}', 'ballmer': 'ballmer/{name}/{company}/{from}', + 'bday': 'bday/{name}/{from}', 'because': 'because/{from}', + 'blackadder': 'blackadder/{name}/{from}', + 'bm': 'bm/{name}/{from}', + 'bucket': 'bucket/{from}', 'bus': 'bus/{name}/{from}', 'bye': 'bye/{from}', 'caniuse': 'caniuse/{name}/{from}', 'chainsaw': 'chainsaw/{name}/{from}', + 'cocksplat': 'cocksplat/{name}/{from}', 'cool': 'cool/{from}', + 'cup': 'cup/{from}', + 'dalton': 'dalton/{name}/{from}', + 'deraadt': 'deraadt/{name}/{from}', 'diabetes': 'diabetes/{from}', 'donut': 'donut/{name}/{from}', + 'dosomething': 'dosomething/{verb}/{thing}/{from}', 'everyone': 'everyone/{from}', 'everything': 'everything/{from}', + 'family': 'family/{from}', 'fascinating': 'fascinating/{from}', 'field': 'field/{name}/{from}/{reference}', 'flying': 'flying/{from}', + 'fyyff': 'fyyff/{from}', + 'gfy': 'gfy/{name}/{from}', + 'give': 'give/{from}', + 'greed': 'greed/{thing}/{from}', + 'horse': 'horse/{from}', + 'immensity': 'immensity/{from}', + 'ing': 'ing/{name}/{from}', + 'keep': 'keep/{name}/{from}', + 'keepcalm': 'keepcalm/{verb}/{from}', 'king': 'king/{name}/{from}', 'life': 'life/{from}', 'linus': 'linus/{name}/{from}', + 'look': 'look/{name}', + 'looking': 'looking/{from}', 'madison': 'madison/{name}/{from}', + 'maybe': 'maybe/{from}', + 'me': 'me/{from}', + 'mornin': 'morning/{from}', + 'no': 'no/{from}', 'nugget': 'nugget/{name}/{from}', 'off': 'off/{name}/{from}', + 'off-with': 'off-with/{thing}/{from}', 'outside': 'outside/{name}/{from}', + 'particular': 'particular/{thing}/{from}', 'pink': 'pink/{from}', + 'problem': 'problem/{name}/{from}', + 'programmer': 'programmer/{from}', + 'pulp': 'pulp/{thing}/{from}', + 'retard': 'retard/{from}', + 'rediculous': 'rediculous/{from}', + 'rtfm': 'rftm/{from}', + 'sake': 'sake/{from}', + 'shakespeare': 'shakespeare/{name}/{from}', + 'shit': 'shit/{from}', + 'shutup': 'shutup/{name}/{from}', + 'single': 'single/{from}', 'thanks': 'thanks/{from}', 'that': 'that/{from}', + 'think': 'think/{name}/{from}', + 'thinking': 'thinking/{name}/{from}', 'thing': '{thing}/{from}', 'this': 'this/{from}', - 'shakespeare': 'shakespeare/{name}/{from}', + 'thumbs': 'thumbs/{name}/{from}', + 'too': 'too/{from}', + 'tucker': 'tucker/{from}', 'what': 'what/{from}', 'xmas': 'xmas/{name}/{from}', 'yoda': 'yoda/{name}/{from}', 'you': 'you/{name}/{from}', + 'zayn': 'zayne/{from}', + 'zero': 'zero/{from}' } def __init__(self, secure=False, language=None): @@ -118,7 +167,7 @@ def random(self, **kwargs): def build_url(self, path, **kwargs): # use from_ since from is a keyword. *grumble* params = dict([(k.rstrip('_'), quote(v)) for k, v - in kwargs.items() if v]) + in kwargs.items() if v]) url = '{protocol}://foaas.herokuapp.com/{path}'.format( protocol='https' if self.secure else 'http', path=path.format(**params)) @@ -131,24 +180,27 @@ def build_url(self, path, **kwargs): parser = OptionParser() parser.add_option('-a', '--action', dest='action', default='off', - help='Name of the action to perform') + help='Name of the action to perform') parser.add_option('-n', '--name', dest='name', - help='Who do you want to fuck off?') + help='Who do you want to fuck off?') parser.add_option('-f', '--from', dest='from', help='Who are you?') parser.add_option('-c', '--company', dest='company', - help='Which company do you want to fuck off?') + help='Which company do you want to fuck off?') parser.add_option('-t', '--thing', dest='thing', - help='What thing do you want to fuck off?') + help='What thing do you want to fuck off?') parser.add_option('-r', '--reference', dest='reference', - help='Who do you want to reference?') + help='Who do you want to reference?') + + parser.add_option('-v', '--verb', dest='verb', + help='What do you want fucking done?') parser.add_option('-u', '--url', action='store_true', dest='url', - help='Only display the URL (useful for c/ping)') + help='Only display the URL (useful for c/ping)') (options, args) = parser.parse_args() diff --git a/tests.py b/tests.py index 35101f7..7c23eaf 100644 --- a/tests.py +++ b/tests.py @@ -17,7 +17,8 @@ def test_url_secure(self): def test_url_quoting(self): url = self.fuck.donut(name='Alice!', from_='Bobby McGee').url - self.assertEqual('http://foaas.herokuapp.com/donut/Alice%21/Bobby%20McGee', url) + self.assertEqual( + 'http://foaas.herokuapp.com/donut/Alice%21/Bobby%20McGee', url) def test_html(self): html = self.fuck.thanks(from_='Bob').html @@ -40,6 +41,8 @@ def test_random(self): self.fuck.random(name='Tom', from_='Chris') self.fuck.random(name='Alice', from_='Bob', company='Acme') self.fuck.random(name='Alice', from_='Bob', reference='Clara') + self.fuck.random(from_='Alice', verb='Grind') + self.fuck.random(from_='Alice', thing='Wallet', verb='Grind') if __name__ == '__main__':