fixing how to get discussion comments
This commit is contained in:
parent
28e34de14b
commit
41c79f0a73
123
gh_gsql_req.py
123
gh_gsql_req.py
@ -19,40 +19,39 @@ def get_discussion_gql(repo_owner, repo_name):
|
||||
data_string = ("""
|
||||
query {
|
||||
repository(owner: """ + repo_owner + """, name: """ + repo_name + """) {
|
||||
discussions(first: 3) {
|
||||
# type: DiscussionConnection
|
||||
totalCount # Int!
|
||||
|
||||
edges {
|
||||
# type: DiscussionEdge
|
||||
cursor
|
||||
node {
|
||||
# type: Discussion
|
||||
id
|
||||
title # String!
|
||||
bodyText # String!
|
||||
createdViaEmail # Boolean!
|
||||
createdAt # DateTime!
|
||||
answer {
|
||||
#type: DiscussionComment
|
||||
bodyText # String!
|
||||
}
|
||||
comments(first: 10){
|
||||
# type: DiscussionCommentConnection
|
||||
totalCount # Int!
|
||||
edges {
|
||||
# type: DiscussionCommentEdge
|
||||
node {
|
||||
# type: DiscussionComment
|
||||
id
|
||||
bodyText # String!
|
||||
issues(last: 2) {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
title
|
||||
url
|
||||
number
|
||||
state
|
||||
author {
|
||||
url
|
||||
}
|
||||
|
||||
labels(first:5) {
|
||||
edges {
|
||||
node {
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
comments(first: 10) {
|
||||
# edges.node is where the actual `Comment` object is
|
||||
edges {
|
||||
node {
|
||||
author {
|
||||
avatarUrl
|
||||
}
|
||||
body
|
||||
}
|
||||
}
|
||||
}
|
||||
body
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
""")
|
||||
@ -60,7 +59,7 @@ def get_discussion_gql(repo_owner, repo_name):
|
||||
data_json = json.dumps(data)
|
||||
headers = {'content-type': 'application/json', 'Accept-Charset': 'UTF-8', 'Authorization': 'bearer ' + key}
|
||||
r = requests.post(url=url, data=data_json, headers=headers)
|
||||
#print(r.content)
|
||||
print(r.content)
|
||||
return r.json()
|
||||
|
||||
def within_time(comment_content, early_cutoff):
|
||||
@ -79,7 +78,9 @@ def within_time(comment_content, early_cutoff):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
get_discussion_gql()
|
||||
repo_name = '"' + 'numpy' + '"'
|
||||
repo_owner = '"' + 'numpy' + '"'
|
||||
get_discussion_gql(repo_owner, repo_name)
|
||||
|
||||
|
||||
# stashed info about page cursors
|
||||
@ -90,4 +91,62 @@ if __name__ == "__main__":
|
||||
hasNextPage
|
||||
hasPreviousPage
|
||||
}
|
||||
'''
|
||||
|
||||
'''
|
||||
issue(number: 2) {
|
||||
title
|
||||
createdAt
|
||||
# first 10 results
|
||||
comments(first: 10) {
|
||||
# edges.node is where the actual `Comment` object is
|
||||
edges {
|
||||
node {
|
||||
author {
|
||||
avatarUrl
|
||||
}
|
||||
body
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
'''
|
||||
|
||||
'''
|
||||
discussions(first: 10) {
|
||||
# type: DiscussionConnection
|
||||
totalCount # Int!
|
||||
|
||||
edges {
|
||||
# type: DiscussionEdge
|
||||
cursor
|
||||
node {
|
||||
# type: Discussion
|
||||
id
|
||||
title # String!
|
||||
bodyText # String!
|
||||
createdViaEmail # Boolean!
|
||||
createdAt # DateTime!
|
||||
answer {
|
||||
#type: DiscussionComment
|
||||
bodyText # String!
|
||||
}
|
||||
comments(first: 10){
|
||||
# type: DiscussionCommentConnection
|
||||
totalCount # Int!
|
||||
edges {
|
||||
# type: DiscussionCommentEdge
|
||||
node {
|
||||
# type: DiscussionComment
|
||||
id
|
||||
bodyText # String!
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
'''
|
Loading…
Reference in New Issue
Block a user