-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.py
88 lines (67 loc) · 2.07 KB
/
client.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
from gwrapper import logger_interface
from gwrapper import wrapper
import logging
# request = wrapper.GWrapper(
# '''{
# "url": ["https://api.github.com/repos/oakbani/f3Github"],
# "credentials":[
# {
# "username": "1234",
# "pwd": "1234"
# }
# ],
# "version": 2
# }'''
# )
class ClientLogger(logger_interface.ExampleLogger):
def __init__(
self,
handler=logging.StreamHandler(),
logger_name=__name__,
min_level=logging.INFO
):
self.logger = logging.getLogger(logger_name)
self.logger.setLevel(min_level)
self.logger.handlers = [handler]
self.min_level = min_level
def log(self, lvl, msg):
self.logger.log(lvl, msg)
request = wrapper.GWrapper(
'''{
"url": "https://api.github.com/repos/oakbani/f3Github",
"username": "MariamJamal32",
"pwd": "Mariam1374",
"version": 1
}''',
ClientLogger()
)
test_client = wrapper.GWrapper(
'''{
"url": "https://api.github.com/repos/oakbani/f3Github",
"username": "MariamJamal32",
"pwd": "Mariam1374",
"version": 1
}''',
logger=logger_interface.ChildLogger()
)
def get_all_pulls(**params):
request.list_pulls(params)
def get_pull(id):
request.list_pull(id)
def get_pull_commits(pull_id):
request.list_pull_commits(pull_id)
def get_pull_files(pull_id):
request.list_pull_files(pull_id)
def get_pr_by_commits():
y = test_client.get_pr_with_num_of_commits(2, 'gt', state="closed")
# z = request.get_pr_by_commit_text(
# ['check', 'abc'], 'any', state="closed"
# )
print(y)
def get_pr_by_files():
return request.get_pr_with_num_of_files(2, 'lt', state="closed")
# z = get_pr_by_files()
get_pr_by_commits()
# request.get_pr_by_commit_text(['check', 'abc'], 'all', state="closed")
# request.get_pr_by_file_name(['.gitignore', 'green'], 'all', state='closed')
# print(z)