Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
26 lines (20 sloc) 965 Bytes
import json
import requests
def jdvr_repos_update_at(date, token):
asdfdss = map(lambda r: {'name': r["name"], 'updated_at': r["updatedAt"].split('T')[0]}, request_repos(token))
return filter(lambda r: r["updated_at"] == date, asdfdss)
def request_repos(token):
query = "{ \"query\": \"query { viewer { repositories(last: 100) { nodes { name updatedAt } } } }\" }\n"
headers = {
'authorization': "bearer " + token
}
response = requests.request("POST", "https://api.github.com/graphql", data=query, headers=headers)
return json.loads(response.text)["data"]["viewer"]["repositories"]["nodes"]
def get_updated_repos(self, today):
for repo in self.__my_repos:
if today == self.last_updated_day_for(repo):
self.__updated_repositories.append(repo["name"])
def last_updated_day_for(self, repo):
return repo['updated_at'].split('T')[0]
def __str__(self):
return ', '.join(self.__updated_repositories)