retreiving my issue activity¤
retreive my activity with the github graphql api.
%reload_ext pidgy
import requests, pandas
from info import header
__import__("requests_cache").install_cache(allowable_methods=["POST"])
construct the query from parameters¤
we use %
string formatting because of the braces in graphql syntaxes.
def get_stamps(user="tonyfast", repo="iota-school/notebooks-for-all"):
return \
query {
search(type:ISSUE, query: "user:%s repo:%s", first: 100) {
edges {
node {
... on Issue {
url
}
... on PullRequest {
url
}
... on Comment {
publishedAt
}
}
}
}
}\
% (user, repo)
def get_stamps(user="tonyfast", repo="iota-school/notebooks-for-all"):
return \
query { search(type:ISSUE, query: "user:%s repo:%s", first: 100) { edges { node { ... on Issue { url } ... on PullRequest { url } ... on Comment { publishedAt } } } } }\
% (user, repo)
<details open="">
<summary>
a graphql query the find the dates a user made comments on issues or pull requests.
</summary>
```graphql
{{get_stamps()}}
```
</details>
a graphql query the find the dates a user made comments on issues or pull requests.
query {
search(type:ISSUE, query: "user:tonyfast repo:iota-school/notebooks-for-all", first: 100) {
edges {
node {
... on Issue {
url
}
... on PullRequest {
url
}
... on Comment {
publishedAt
}
}
}
}
}
df = pandas.DataFrame((
response := requests.post("https://api.github.com/graphql", json=dict(query=get_stamps()), **header)
).json()["data"]["search"]["edges"])["node"].apply(pandas.Series)
df.publishedAt = df.publishedAt.pipe(pandas.to_datetime)
df = pandas.DataFrame((
response := requests.post("https://api.github.com/graphql", json=dict(query=get_stamps()), **header)
).json()["data"]["search"]["edges"])["node"].apply(pandas.Series)
df.publishedAt = df.publishedAt.pipe(pandas.to_datetime)
freq = df.groupby(pandas.Grouper(freq="1D", key="publishedAt")).count()
freq = df.groupby(pandas.Grouper(freq="1D", key="publishedAt")).count()
what days where these comments made at?
days = freq[freq.astype(bool)].dropna()
days
days = freq[freq.astype(bool)].dropna()
days
days
days