Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
#!/usr/bin/env python3
import yaml
import click
from plugins.pagure import get_pull_requests
from pprint import pprint

from plugins import github
from plugins import gitlab
from plugins import pagure

plugins = {
"github": github.get_pull_requests,
"pagure": pagure.get_pull_requests,
# "gitlab": gitlab.get_pull_requests
}

@click.command()
@click.option('--site', default='config', help='Please enter the sitename to list activity, e.g. github')
Expand All @@ -12,18 +21,22 @@ def execute_board(site, username, repo):
'''Take Arguments from command line OR Read configuration files, which is YAML format'''
#print (site)
#print (username)
if site == 'config' and username == 'config' and repo == 'config':
if username == 'config' and repo == 'config':
print ("The Application will read username and code sites from configuraiton file")
with open('config.yml', 'r') as f:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First, check that the file is present or not, you can do that using os module.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now this PR does not focus on config file parsing, we will check this in #23

conf = yaml.load(f)

# Expect site, username and repo comming from command line
#data = get_pull_requests('walters', 'fedora-atomic')
data = get_pull_requests(username, repo)
print (data)



# data = get_pull_requests(username, repo)
# print (data)

if site in plugins.keys():
data = plugins[site](username, repo)
pprint(data)

else:
print("Couldnt find Plugin for site \"%s\"" % site)

def getComments(site, username):
pass
Expand Down
1 change: 1 addition & 0 deletions plugins/github.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import requests
import json

list_of_pull_requests=[]
def get_pull_requests(username,repository):
r=requests.get("https://api.github.com/repos/"+username+"/"+repository+"/pulls")
Expand Down