import os

import requests


class spyonweb(object):

    def __init__(self, token, url=None):
        self.token = token
        if url:
            self.url = url
        else:
            self.url = "https://api.spyonweb.com/v1/"

    def summary(self, domain_name):
        data = requests.get(self.url + "summary/" + domain_name + "?access_token=" + self.token)
        return data.json()

    def domain(self, domain_name):
        data = requests.get(self.url + "domain/" + domain_name + "?access_token=" + self.token)
        return data.json()

    def analytics(self, code, limit=None):
        data = requests.get(self.url + "analytics/" + code + "?access_token=" + self.token + "&limit=" + limit)
        # TODO: implement paging
        return data.json()


def main():
    token = os.getenv("SPYONWEB_API")
    s = spyonweb(token=token)
    a = "UA-34505845"
    print s.analytics(a)


if __name__ == "__main__":
    main()

@@ -2,16 +2,52 @@
 mport os
+%0Afrom argparse import ArgumentParser
 %0A%0Aimport
@@ -812,16 +812,389 @@
 main():%0A
+    parser = ArgumentParser()%0A    parser.add_argument('-s', '--summary', type=str, help=%22Specify a domain for the Request Summary API%22)%0A    parser.add_argument('-d', '--domain', type=str, help=%22Specify a domain for the Domain API%22)%0A    parser.add_argument('-a', '--analytics', type=str, help=%22Specify a code for the Analytics API%22)%0A    args, _ = parser.parse_known_args()%0A%0A
     toke
@@ -1257,34 +1257,155 @@
 en)%0A
+%0A
     
-a = %22UA-34505845%22%0A
+if args.summary:%0A        print s.summary(args.summary)%0A    if args.domain:%0A        print s.domain(args.domain)%0A    if args.analytics:%0A 
     
+   
 prin
@@ -1419,16 +1419,29 @@
 lytics(a
+rgs.analytics
 )%0A%0A%0Aif _

Implement basic command line parsing