{"action":"created","comment":{"url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/pulls/comments/26000965","id":26000965,"diff_hunk":"@@ -19,76 +19,192 @@\n import urlparse\n import time\n import xmlrpclib\n+import ConfigParser, os\n \n+class Config(object):\n+    def __init__(self, config_sources=None):\n+        self.config_sources = config_sources or list()\n \n-def stream_string(s):\n-    separators = '\\n'\n-    start = 0\n-    end = 0\n-    for end in range(len(s)):\n-        if s[end] in separators:\n-            yield s[start:end]\n-            start = end + 1\n-    if start < end:\n-        yield s[start:end+1]\n-\n-def connect(url):\n-    try:\n-        print \"Connecting to Server...\"\n-        connection = xmlrpclib.ServerProxy(url)\n-\n-        print \"Connection Successful!\"\n-        print \"connect-to-server : pass\"\n-        return connection\n-    except (xmlrpclib.ProtocolError, xmlrpclib.Fault, IOError) as e:\n-        print \"CONNECTION ERROR!\"\n-        print \"Unable to connect to %s\" % url\n-        print e\n-        print \"connect-to-server : fail\"\n-        exit(1)\n-\n-def validate_input(username, token, server):\n-    url = urlparse.urlparse(server)\n-    if url.path.find('RPC2') == -1:\n-        print \"LAVA Server URL must end with /RPC2\"\n-        exit(1)\n-    return url.scheme + '://' + username + ':' + token + '@' + url.netloc + url.path\n+    def add_config_override(self, config_source):\n+        self.config_sources.insert(0, config_source)\n \n+    def has_enough_config(self):\n+        return (self.get_config_variable('username') and\n+                self.get_config_variable('token') and\n+                self.get_config_variable('server'))\n \n-def main(args):\n-    url = validate_input(args.username, args.token, args.server)\n-    connection = connect(url)\n-    run = True\n-    end_states = ['Complete', 'Incomplete', 'Canceled']\n-    current_job_file = None\n-    old_job_file = None\n-    latest = None\n-\n-    while run:\n+    def construct_url(self):\n+        if not self.has_enough_config():\n+            raise Exception(\"Not enough configuration to construct the URL\")\n+\n+        url = urlparse.urlparse(self.get_config_variable('server'))\n+\n+        if not url.path.endswith('/RPC2'):","path":"stream-lava-log.py","position":66,"original_position":66,"commit_id":"93066d9f738551fbb83d8856a1c445ec4954d74a","original_commit_id":"93066d9f738551fbb83d8856a1c445ec4954d74a","user":{"login":"EmbeddedAndroid","id":1061011,"avatar_url":"https://avatars.githubusercontent.com/u/1061011?v=3","gravatar_id":"","url":"https://api.github.com/users/EmbeddedAndroid","html_url":"https://github.com/EmbeddedAndroid","followers_url":"https://api.github.com/users/EmbeddedAndroid/followers","following_url":"https://api.github.com/users/EmbeddedAndroid/following{/other_user}","gists_url":"https://api.github.com/users/EmbeddedAndroid/gists{/gist_id}","starred_url":"https://api.github.com/users/EmbeddedAndroid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EmbeddedAndroid/subscriptions","organizations_url":"https://api.github.com/users/EmbeddedAndroid/orgs","repos_url":"https://api.github.com/users/EmbeddedAndroid/repos","events_url":"https://api.github.com/users/EmbeddedAndroid/events{/privacy}","received_events_url":"https://api.github.com/users/EmbeddedAndroid/received_events","type":"User","site_admin":false},"body":"/RPC2/ is a valid case as well.","created_at":"2015-03-08T00:20:06Z","updated_at":"2015-03-08T00:20:06Z","html_url":"https://github.com/EmbeddedAndroid/lava-hacks/pull/1#discussion_r26000965","pull_request_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/pulls/comments/26000965"},"html":{"href":"https://github.com/EmbeddedAndroid/lava-hacks/pull/1#discussion_r26000965"},"pull_request":{"href":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/pulls/1","id":30711402,"html_url":"https://github.com/EmbeddedAndroid/lava-hacks/pull/1","diff_url":"https://github.com/EmbeddedAndroid/lava-hacks/pull/1.diff","patch_url":"https://github.com/EmbeddedAndroid/lava-hacks/pull/1.patch","issue_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/issues/1","number":1,"state":"open","locked":false,"title":"Lavarc","user":{"login":"roxell","id":4140462,"avatar_url":"https://avatars.githubusercontent.com/u/4140462?v=3","gravatar_id":"","url":"https://api.github.com/users/roxell","html_url":"https://github.com/roxell","followers_url":"https://api.github.com/users/roxell/followers","following_url":"https://api.github.com/users/roxell/following{/other_user}","gists_url":"https://api.github.com/users/roxell/gists{/gist_id}","starred_url":"https://api.github.com/users/roxell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roxell/subscriptions","organizations_url":"https://api.github.com/users/roxell/orgs","repos_url":"https://api.github.com/users/roxell/repos","events_url":"https://api.github.com/users/roxell/events{/privacy}","received_events_url":"https://api.github.com/users/roxell/received_events","type":"User","site_admin":false},"body":"added support for config file(s) and refactored it into classes and smaller isolated pieces. ","created_at":"2015-03-07T23:33:23Z","updated_at":"2015-03-08T00:20:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"15e891dd69eb56b65f6903fe0526c8830f2e2d5d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/pulls/1/commits","review_comments_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/pulls/1/comments","review_comment_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/pulls/comments{/number}","comments_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/issues/1/comments","statuses_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/statuses/93066d9f738551fbb83d8856a1c445ec4954d74a","head":{"label":"roxell:lavarc","ref":"lavarc","sha":"93066d9f738551fbb83d8856a1c445ec4954d74a","user":{"login":"roxell","id":4140462,"avatar_url":"https://avatars.githubusercontent.com/u/4140462?v=3","gravatar_id":"","url":"https://api.github.com/users/roxell","html_url":"https://github.com/roxell","followers_url":"https://api.github.com/users/roxell/followers","following_url":"https://api.github.com/users/roxell/following{/other_user}","gists_url":"https://api.github.com/users/roxell/gists{/gist_id}","starred_url":"https://api.github.com/users/roxell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roxell/subscriptions","organizations_url":"https://api.github.com/users/roxell/orgs","repos_url":"https://api.github.com/users/roxell/repos","events_url":"https://api.github.com/users/roxell/events{/privacy}","received_events_url":"https://api.github.com/users/roxell/received_events","type":"User","site_admin":false},"repo":{"id":31831420,"name":"lava-hacks","full_name":"roxell/lava-hacks","owner":{"login":"roxell","id":4140462,"avatar_url":"https://avatars.githubusercontent.com/u/4140462?v=3","gravatar_id":"","url":"https://api.github.com/users/roxell","html_url":"https://github.com/roxell","followers_url":"https://api.github.com/users/roxell/followers","following_url":"https://api.github.com/users/roxell/following{/other_user}","gists_url":"https://api.github.com/users/roxell/gists{/gist_id}","starred_url":"https://api.github.com/users/roxell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roxell/subscriptions","organizations_url":"https://api.github.com/users/roxell/orgs","repos_url":"https://api.github.com/users/roxell/repos","events_url":"https://api.github.com/users/roxell/events{/privacy}","received_events_url":"https://api.github.com/users/roxell/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/roxell/lava-hacks","description":"a series of useful cli utilities for LAVA server interactions","fork":true,"url":"https://api.github.com/repos/roxell/lava-hacks","forks_url":"https://api.github.com/repos/roxell/lava-hacks/forks","keys_url":"https://api.github.com/repos/roxell/lava-hacks/keys{/key_id}","collaborators_url":"https://api.github.com/repos/roxell/lava-hacks/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/roxell/lava-hacks/teams","hooks_url":"https://api.github.com/repos/roxell/lava-hacks/hooks","issue_events_url":"https://api.github.com/repos/roxell/lava-hacks/issues/events{/number}","events_url":"https://api.github.com/repos/roxell/lava-hacks/events","assignees_url":"https://api.github.com/repos/roxell/lava-hacks/assignees{/user}","branches_url":"https://api.github.com/repos/roxell/lava-hacks/branches{/branch}","tags_url":"https://api.github.com/repos/roxell/lava-hacks/tags","blobs_url":"https://api.github.com/repos/roxell/lava-hacks/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/roxell/lava-hacks/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/roxell/lava-hacks/git/refs{/sha}","trees_url":"https://api.github.com/repos/roxell/lava-hacks/git/trees{/sha}","statuses_url":"https://api.github.com/repos/roxell/lava-hacks/statuses/{sha}","languages_url":"https://api.github.com/repos/roxell/lava-hacks/languages","stargazers_url":"https://api.github.com/repos/roxell/lava-hacks/stargazers","contributors_url":"https://api.github.com/repos/roxell/lava-hacks/contributors","subscribers_url":"https://api.github.com/repos/roxell/lava-hacks/subscribers","subscription_url":"https://api.github.com/repos/roxell/lava-hacks/subscription","commits_url":"https://api.github.com/repos/roxell/lava-hacks/commits{/sha}","git_commits_url":"https://api.github.com/repos/roxell/lava-hacks/git/commits{/sha}","comments_url":"https://api.github.com/repos/roxell/lava-hacks/comments{/number}","issue_comment_url":"https://api.github.com/repos/roxell/lava-hacks/issues/comments{/number}","contents_url":"https://api.github.com/repos/roxell/lava-hacks/contents/{+path}","compare_url":"https://api.github.com/repos/roxell/lava-hacks/compare/{base}...{head}","merges_url":"https://api.github.com/repos/roxell/lava-hacks/merges","archive_url":"https://api.github.com/repos/roxell/lava-hacks/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/roxell/lava-hacks/downloads","issues_url":"https://api.github.com/repos/roxell/lava-hacks/issues{/number}","pulls_url":"https://api.github.com/repos/roxell/lava-hacks/pulls{/number}","milestones_url":"https://api.github.com/repos/roxell/lava-hacks/milestones{/number}","notifications_url":"https://api.github.com/repos/roxell/lava-hacks/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/roxell/lava-hacks/labels{/name}","releases_url":"https://api.github.com/repos/roxell/lava-hacks/releases{/id}","created_at":"2015-03-07T23:23:47Z","updated_at":"2015-03-07T23:23:48Z","pushed_at":"2015-03-07T23:26:32Z","git_url":"git://github.com/roxell/lava-hacks.git","ssh_url":"git@github.com:roxell/lava-hacks.git","clone_url":"https://github.com/roxell/lava-hacks.git","svn_url":"https://github.com/roxell/lava-hacks","homepage":"","size":140,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"EmbeddedAndroid:master","ref":"master","sha":"cad53470a779be181cc9cb67882692dc95edf0c5","user":{"login":"EmbeddedAndroid","id":1061011,"avatar_url":"https://avatars.githubusercontent.com/u/1061011?v=3","gravatar_id":"","url":"https://api.github.com/users/EmbeddedAndroid","html_url":"https://github.com/EmbeddedAndroid","followers_url":"https://api.github.com/users/EmbeddedAndroid/followers","following_url":"https://api.github.com/users/EmbeddedAndroid/following{/other_user}","gists_url":"https://api.github.com/users/EmbeddedAndroid/gists{/gist_id}","starred_url":"https://api.github.com/users/EmbeddedAndroid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EmbeddedAndroid/subscriptions","organizations_url":"https://api.github.com/users/EmbeddedAndroid/orgs","repos_url":"https://api.github.com/users/EmbeddedAndroid/repos","events_url":"https://api.github.com/users/EmbeddedAndroid/events{/privacy}","received_events_url":"https://api.github.com/users/EmbeddedAndroid/received_events","type":"User","site_admin":false},"repo":{"id":31152767,"name":"lava-hacks","full_name":"EmbeddedAndroid/lava-hacks","owner":{"login":"EmbeddedAndroid","id":1061011,"avatar_url":"https://avatars.githubusercontent.com/u/1061011?v=3","gravatar_id":"","url":"https://api.github.com/users/EmbeddedAndroid","html_url":"https://github.com/EmbeddedAndroid","followers_url":"https://api.github.com/users/EmbeddedAndroid/followers","following_url":"https://api.github.com/users/EmbeddedAndroid/following{/other_user}","gists_url":"https://api.github.com/users/EmbeddedAndroid/gists{/gist_id}","starred_url":"https://api.github.com/users/EmbeddedAndroid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EmbeddedAndroid/subscriptions","organizations_url":"https://api.github.com/users/EmbeddedAndroid/orgs","repos_url":"https://api.github.com/users/EmbeddedAndroid/repos","events_url":"https://api.github.com/users/EmbeddedAndroid/events{/privacy}","received_events_url":"https://api.github.com/users/EmbeddedAndroid/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/EmbeddedAndroid/lava-hacks","description":"a series of useful cli utilities for LAVA server interactions","fork":false,"url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks","forks_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/forks","keys_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/keys{/key_id}","collaborators_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/teams","hooks_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/hooks","issue_events_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/issues/events{/number}","events_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/events","assignees_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/assignees{/user}","branches_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/branches{/branch}","tags_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/tags","blobs_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/git/refs{/sha}","trees_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/git/trees{/sha}","statuses_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/statuses/{sha}","languages_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/languages","stargazers_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/stargazers","contributors_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/contributors","subscribers_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/subscribers","subscription_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/subscription","commits_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/commits{/sha}","git_commits_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/git/commits{/sha}","comments_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/comments{/number}","issue_comment_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/issues/comments{/number}","contents_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/contents/{+path}","compare_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/compare/{base}...{head}","merges_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/merges","archive_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/downloads","issues_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/issues{/number}","pulls_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/pulls{/number}","milestones_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/milestones{/number}","notifications_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/labels{/name}","releases_url":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/releases{/id}","created_at":"2015-02-22T04:42:55Z","updated_at":"2015-02-22T06:21:34Z","pushed_at":"2015-02-22T06:21:34Z","git_url":"git://github.com/EmbeddedAndroid/lava-hacks.git","ssh_url":"git@github.com:EmbeddedAndroid/lava-hacks.git","clone_url":"https://github.com/EmbeddedAndroid/lava-hacks.git","svn_url":"https://github.com/EmbeddedAndroid/lava-hacks","homepage":"","size":140,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/pulls/1"},"html":{"href":"https://github.com/EmbeddedAndroid/lava-hacks/pull/1"},"issue":{"href":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/issues/1"},"comments":{"href":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/EmbeddedAndroid/lava-hacks/statuses/93066d9f738551fbb83d8856a1c445ec4954d74a"}}}}