index
|
execution_count
|
cell_type
|
toolbar
|
started_at
|
completed_at
|
source
|
loc
|
metadata
|
outputs
|
1
|
|
|
|
|
|
# retreiving my issue activity
retreive my activity with the github graphql api.
|
|
3
|
retreive my activity with the github graphql api.
|
2
|
|
|
|
|
|
%reload_ext pidgy
import requests, pandas
from info import header
__import__("requests_cache").install_cache(allowable_methods=["POST"])
|
|
5
|
0 outputs.
|
3
|
|
|
|
|
|
## construct the query from parameters
we use `%` string formatting because of the braces in graphql syntaxes.
|
|
3
|
we use
%
string formatting because of the braces in graphql syntaxes.
|
4
|
|
|
|
|
|
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)
|
|
21
|
1 outputs.
|
5
|
|
|
|
|
|
<details open>
<summary>
a graphql query the find the dates a user made comments on issues or pull requests.
</summary>
```graphql
{{get_stamps()}}
```
</details>
|
|
11
|
1 outputs.
|
6
|
|
|
|
|
|
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)
|
|
6
|
1 outputs.
|
7
|
|
|
|
|
|
freq = df.groupby(pandas.Grouper(freq="1D", key="publishedAt")).count()
|
|
1
|
1 outputs.
|
8
|
|
|
|
|
|
what days where these comments made at?
|
|
1
|
what days where these comments made at?
|
9
|
|
|
|
|
|
days = freq[freq.astype(bool)].dropna()
days
|
|
2
|
2 outputs.
|
10
|
|
|
|
|
|
|
|
1
|
2 outputs.
|
11
|
|
|
|
|
|
|
|
0
|
|