mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-01 11:21:16 +00:00
Gists with since (#914)
The Github gists api has a since parameter for the various gist searches. This adds that parameter to Github.get_gists(), NamedUser.get_gists() and Authenticator.get_gists(). Tests and replay data added/updated as needed. I added a Time module in the tests directory, containing just a UTCtzinfo class, which I felt I needed for one of the tests (and would probably be useful in other since/until tests). Might not be the best name for the module but it seemed the least invasive thing to do.
This commit is contained in:
committed by
Wan Liuyang
parent
a18eeb3a05
commit
e18b107883
@@ -14,12 +14,13 @@
|
||||
# Copyright 2016 E. Dunham <github@edunham.net> #
|
||||
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
||||
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
||||
# Copyright 2017 Balázs Rostás <rostas.balazs@gmail.com> #
|
||||
# Copyright 2017 Balázs Rostás <rostas.balazs@gmail.com> #
|
||||
# Copyright 2017 Jannis Gebauer <ja.geb@me.com> #
|
||||
# Copyright 2017 Simon <spam@esemi.ru> #
|
||||
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
||||
# Copyright 2018 bryanhuntesl <31992054+bryanhuntesl@users.noreply.github.com> #
|
||||
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
||||
# Copyright 2018 itsbruce <it.is.bruce@gmail.com> #
|
||||
# #
|
||||
# This file is part of PyGithub. #
|
||||
# http://pygithub.readthedocs.io/ #
|
||||
@@ -703,16 +704,21 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject):
|
||||
None
|
||||
)
|
||||
|
||||
def get_gists(self):
|
||||
def get_gists(self, since=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `GET /gists <http://developer.github.com/v3/gists>`_
|
||||
:param since: datetime.datetime format YYYY-MM-DDTHH:MM:SSZ
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Gist.Gist`
|
||||
"""
|
||||
assert since is github.GithubObject.NotSet or isinstance(since, datetime.datetime), since
|
||||
url_parameters = dict()
|
||||
if since is not github.GithubObject.NotSet:
|
||||
url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Gist.Gist,
|
||||
self._requester,
|
||||
"/gists",
|
||||
None
|
||||
url_parameters
|
||||
)
|
||||
|
||||
def get_issues(self, filter=github.GithubObject.NotSet, state=github.GithubObject.NotSet, labels=github.GithubObject.NotSet, sort=github.GithubObject.NotSet, direction=github.GithubObject.NotSet, since=github.GithubObject.NotSet):
|
||||
|
||||
+10
-2
@@ -27,6 +27,7 @@
|
||||
# Copyright 2018 Svend Sorensen <svend@svends.net> #
|
||||
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
||||
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
||||
# Copyright 2018 itsbruce <it.is.bruce@gmail.com> #
|
||||
# #
|
||||
# This file is part of PyGithub. #
|
||||
# http://pygithub.readthedocs.io/ #
|
||||
@@ -46,6 +47,8 @@
|
||||
# #
|
||||
################################################################################
|
||||
|
||||
import datetime
|
||||
|
||||
import urllib
|
||||
import pickle
|
||||
import time
|
||||
@@ -334,16 +337,21 @@ class Github(object):
|
||||
)
|
||||
return github.Gist.Gist(self.__requester, headers, data, completed=True)
|
||||
|
||||
def get_gists(self):
|
||||
def get_gists(self, since=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `GET /gists/public <http://developer.github.com/v3/gists>`_
|
||||
:param since: datetime.datetime format YYYY-MM-DDTHH:MM:SSZ
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Gist.Gist`
|
||||
"""
|
||||
assert since is github.GithubObject.NotSet or isinstance(since, datetime.datetime), since
|
||||
url_parameters = dict()
|
||||
if since is not github.GithubObject.NotSet:
|
||||
url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Gist.Gist,
|
||||
self.__requester,
|
||||
"/gists/public",
|
||||
None
|
||||
url_parameters
|
||||
)
|
||||
|
||||
def search_repositories(self, query, sort=github.GithubObject.NotSet, order=github.GithubObject.NotSet, **qualifiers):
|
||||
|
||||
+10
-2
@@ -17,6 +17,7 @@
|
||||
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
||||
# Copyright 2018 namc <namratachaudhary@users.noreply.github.com> #
|
||||
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
||||
# Copyright 2018 itsbruce <it.is.bruce@gmail.com> #
|
||||
# #
|
||||
# This file is part of PyGithub. #
|
||||
# http://pygithub.readthedocs.io/ #
|
||||
@@ -36,6 +37,8 @@
|
||||
# #
|
||||
################################################################################
|
||||
|
||||
import datetime
|
||||
|
||||
import github.GithubObject
|
||||
import github.PaginatedList
|
||||
|
||||
@@ -402,16 +405,21 @@ class NamedUser(github.GithubObject.CompletableGithubObject):
|
||||
None
|
||||
)
|
||||
|
||||
def get_gists(self):
|
||||
def get_gists(self, since=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `GET /users/:user/gists <http://developer.github.com/v3/gists>`_
|
||||
:param since: datetime.datetime format YYYY-MM-DDTHH:MM:SSZ
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Gist.Gist`
|
||||
"""
|
||||
assert since is github.GithubObject.NotSet or isinstance(since, datetime.datetime), since
|
||||
url_parameters = dict()
|
||||
if since is not github.GithubObject.NotSet:
|
||||
url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Gist.Gist,
|
||||
self._requester,
|
||||
self.url + "/gists",
|
||||
None
|
||||
url_parameters
|
||||
)
|
||||
|
||||
def get_keys(self):
|
||||
|
||||
@@ -8,10 +8,11 @@
|
||||
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
||||
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
||||
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
||||
# Copyright 2017 Balázs Rostás <rostas.balazs@gmail.com> #
|
||||
# Copyright 2017 Balázs Rostás <rostas.balazs@gmail.com> #
|
||||
# Copyright 2017 Jannis Gebauer <ja.geb@me.com> #
|
||||
# Copyright 2018 Jacopo Notarstefano <jacopo.notarstefano@gmail.com> #
|
||||
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
||||
# Copyright 2018 itsbruce <it.is.bruce@gmail.com> #
|
||||
# #
|
||||
# This file is part of PyGithub. #
|
||||
# http://pygithub.readthedocs.io/ #
|
||||
@@ -186,6 +187,7 @@ class AuthenticatedUser(Framework.TestCase):
|
||||
|
||||
def testGetGists(self):
|
||||
self.assertListKeyEqual(self.user.get_gists(), lambda g: g.id, ["2793505", "2793179", "11cb445f8197e17d303d", "1942384", "dcb7de17e8a52b74541d"])
|
||||
self.assertListKeyEqual(self.user.get_gists(since=datetime.datetime(2012, 3, 1, 23, 0, 0)), lambda g: g.id, ["2793505", "2793179", "11cb445f8197e17d303d"])
|
||||
|
||||
def testGetStarredGists(self):
|
||||
self.assertListKeyEqual(self.user.get_starred_gists(), lambda g: g.id, ["1942384", "dcb7de17e8a52b74541d"])
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
# Copyright 2018 Svend Sorensen <svend@svends.net> #
|
||||
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
||||
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
||||
# Copyright 2018 itsbruce <it.is.bruce@gmail.com> #
|
||||
# #
|
||||
# This file is part of PyGithub. #
|
||||
# http://pygithub.readthedocs.io/ #
|
||||
@@ -35,6 +36,8 @@ import datetime
|
||||
|
||||
import Framework
|
||||
|
||||
import Time
|
||||
|
||||
import github
|
||||
|
||||
|
||||
@@ -42,6 +45,9 @@ class Github(Framework.TestCase):
|
||||
def testGetGists(self):
|
||||
self.assertListKeyBegin(self.g.get_gists(), lambda g: g.id, ["2729695", "2729656", "2729597", "2729584", "2729569", "2729554", "2729543", "2729537", "2729536", "2729533", "2729525", "2729522", "2729519", "2729515", "2729506", "2729487", "2729484", "2729482", "2729441", "2729432", "2729420", "2729398", "2729372", "2729371", "2729351", "2729346", "2729316", "2729304", "2729296", "2729276", "2729272", "2729265", "2729195", "2729160", "2729143", "2729127", "2729119", "2729113", "2729103", "2729069", "2729059", "2729051", "2729029", "2729027", "2729026", "2729022", "2729002", "2728985", "2728979", "2728964", "2728937", "2728933", "2728884", "2728869", "2728866", "2728855", "2728854", "2728853", "2728846", "2728825", "2728814", "2728813", "2728812", "2728805", "2728802", "2728800", "2728798", "2728797", "2728796", "2728793", "2728758", "2728754", "2728751", "2728748", "2728721", "2728716", "2728715", "2728705", "2728701", "2728699", "2728697", "2728688", "2728683", "2728677", "2728649", "2728640", "2728625", "2728620", "2728615", "2728614", "2728565", "2728564", "2728554", "2728523", "2728519", "2728511", "2728497", "2728496", "2728495", "2728487"])
|
||||
|
||||
def testGetGistsWithSince(self):
|
||||
self.assertListKeyBegin(self.g.get_gists(since=datetime.datetime(2018,10,2,10,38,30,00,tzinfo=Time.UTCtzinfo())), lambda g: g.id, ["69b8a5831b74946db944c5451017fa40", "c22050a8705e93d170e0d4ca9c02e40c", "a7a95e1a194e07960364a5b32c56ac5f", "a25d9ace89b574f95bf0724f95a84fc2", "3195465"])
|
||||
|
||||
def testGetHooks(self):
|
||||
hooks = self.g.get_hooks()
|
||||
hook = hooks[0]
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
# Copyright 2017 Simon <spam@esemi.ru> #
|
||||
# Copyright 2018 namc <namratachaudhary@users.noreply.github.com> #
|
||||
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
||||
# Copyright 2018 itsbruce <it.is.bruce@gmail.com> #
|
||||
# #
|
||||
# This file is part of PyGithub. #
|
||||
# http://pygithub.readthedocs.io/ #
|
||||
@@ -107,6 +108,7 @@ class NamedUser(Framework.TestCase):
|
||||
|
||||
def testGetGists(self):
|
||||
self.assertListKeyEqual(self.user.get_gists(), lambda g: g.description, ["Gist created by PyGithub", "FairThreadPoolPool.cpp", "How to error 500 Github API v3, as requested by Rick (GitHub Staff)", "Cadfael: order of episodes in French DVD edition"])
|
||||
self.assertListKeyEqual(self.user.get_gists(since=datetime.datetime(2012, 3, 1, 17, 0, 0)), lambda g: g.description, ["Gist created by PyGithub", "FairThreadPoolPool.cpp"])
|
||||
|
||||
def testGetFollowers(self):
|
||||
self.assertListKeyEqual(self.user.get_followers(), lambda f: f.login, ["jnorthrup", "brugidou", "regisb", "walidk", "afzalkhan", "sdanzan", "vineus", "gturri", "fjardon", "cjuniet", "jardon-u", "kamaradclimber", "L42y"])
|
||||
|
||||
@@ -9,3 +9,14 @@ None
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4966'), ('content-length', '4507'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"868b9c31808f738e0f03284a2e538a41"'), ('date', 'Sat, 26 May 2012 20:14:40 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
[{"updated_at":"2012-05-26T11:08:22Z","url":"https://api.github.com/gists/2793505","comments":0,"public":true,"git_pull_url":"git://gist.github.com/2793505.git","git_push_url":"git@gist.github.com:2793505.git","files":{"foobar.txt":{"type":"text/plain","raw_url":"https://gist.github.com/raw/2793505/73a1c7f17aa0ad5d7cbb5a8ca033ce47d3d23197/foobar.txt","size":24,"filename":"foobar.txt","language":"Text"}},"user":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"description":null,"created_at":"2012-05-26T11:08:22Z","id":"2793505","html_url":"https://gist.github.com/2793505"},{"updated_at":"2012-05-26T10:09:33Z","url":"https://api.github.com/gists/2793179","comments":0,"public":true,"git_pull_url":"git://gist.github.com/2793179.git","git_push_url":"git@gist.github.com:2793179.git","files":{"foobar.txt":{"type":"text/plain","raw_url":"https://gist.github.com/raw/2793179/73a1c7f17aa0ad5d7cbb5a8ca033ce47d3d23197/foobar.txt","size":24,"filename":"foobar.txt","language":"Text"}},"user":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"description":"Gist created by PyGithub","created_at":"2012-05-26T09:50:02Z","id":"2793179","html_url":"https://gist.github.com/2793179"},{"updated_at":"2012-04-26T13:20:53Z","url":"https://api.github.com/gists/11cb445f8197e17d303d","comments":0,"public":false,"git_pull_url":"git://gist.github.com/11cb445f8197e17d303d.git","git_push_url":"git@gist.github.com:11cb445f8197e17d303d.git","files":{"FairThreadPoolPool.cpp":{"type":"text/plain","raw_url":"https://gist.github.com/raw/11cb445f8197e17d303d/0f72c6fe50eb011eacb4e39fa613bdfe2f7a0c51/FairThreadPoolPool.cpp","size":7779,"filename":"FairThreadPoolPool.cpp","language":"C++"}},"user":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"description":"FairThreadPoolPool.cpp","created_at":"2012-04-26T13:20:53Z","id":"11cb445f8197e17d303d","html_url":"https://gist.github.com/11cb445f8197e17d303d"},{"updated_at":"2012-02-29T16:47:12Z","url":"https://api.github.com/gists/1942384","comments":0,"public":true,"git_pull_url":"git://gist.github.com/1942384.git","git_push_url":"git@gist.github.com:1942384.git","files":{"fail_github.py":{"type":"application/python","raw_url":"https://gist.github.com/raw/1942384/2fb3aa84e0efa50dc0f4c18b5df5b7b9ab27076b/fail_github.py","size":1636,"filename":"fail_github.py","language":"Python"}},"user":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"description":"How to error 500 Github API v3, as requested by Rick (GitHub Staff)","created_at":"2012-02-29T16:47:12Z","id":"1942384","html_url":"https://gist.github.com/1942384"},{"updated_at":"2012-02-28T19:44:42Z","url":"https://api.github.com/gists/dcb7de17e8a52b74541d","comments":1,"public":false,"git_pull_url":"git://gist.github.com/dcb7de17e8a52b74541d.git","git_push_url":"git@gist.github.com:dcb7de17e8a52b74541d.git","files":{"cadfael.txt":{"type":"text/plain","raw_url":"https://gist.github.com/raw/dcb7de17e8a52b74541d/48ca696645682d7430d73180814434e0284796b2/cadfael.txt","size":585,"filename":"cadfael.txt","language":"Text"}},"user":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"description":"Cadfael: order of episodes in French DVD edition","created_at":"2012-02-28T19:44:42Z","id":"dcb7de17e8a52b74541d","html_url":"https://gist.github.com/dcb7de17e8a52b74541d"}]
|
||||
|
||||
https
|
||||
GET
|
||||
api.github.com
|
||||
None
|
||||
/gists?since=2012-03-01T23%3A00%3A00Z
|
||||
{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
|
||||
None
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4966'), ('content-length', '2637'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"683e9f38128c378e0a30284b2e539a14"'), ('date', 'Sat, 26 May 2012 20:15:03 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
[{"updated_at":"2012-05-26T11:08:22Z","url":"https://api.github.com/gists/2793505","comments":0,"public":true,"git_pull_url":"git://gist.github.com/2793505.git","git_push_url":"git@gist.github.com:2793505.git","files":{"foobar.txt":{"type":"text/plain","raw_url":"https://gist.github.com/raw/2793505/73a1c7f17aa0ad5d7cbb5a8ca033ce47d3d23197/foobar.txt","size":24,"filename":"foobar.txt","language":"Text"}},"user":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"description":null,"created_at":"2012-05-26T11:08:22Z","id":"2793505","html_url":"https://gist.github.com/2793505"},{"updated_at":"2012-05-26T10:09:33Z","url":"https://api.github.com/gists/2793179","comments":0,"public":true,"git_pull_url":"git://gist.github.com/2793179.git","git_push_url":"git@gist.github.com:2793179.git","files":{"foobar.txt":{"type":"text/plain","raw_url":"https://gist.github.com/raw/2793179/73a1c7f17aa0ad5d7cbb5a8ca033ce47d3d23197/foobar.txt","size":24,"filename":"foobar.txt","language":"Text"}},"user":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"description":"Gist created by PyGithub","created_at":"2012-05-26T09:50:02Z","id":"2793179","html_url":"https://gist.github.com/2793179"},{"updated_at":"2012-04-26T13:20:53Z","url":"https://api.github.com/gists/11cb445f8197e17d303d","comments":0,"public":false,"git_pull_url":"git://gist.github.com/11cb445f8197e17d303d.git","git_push_url":"git@gist.github.com:11cb445f8197e17d303d.git","files":{"FairThreadPoolPool.cpp":{"type":"text/plain","raw_url":"https://gist.github.com/raw/11cb445f8197e17d303d/0f72c6fe50eb011eacb4e39fa613bdfe2f7a0c51/FairThreadPoolPool.cpp","size":7779,"filename":"FairThreadPoolPool.cpp","language":"C++"}},"user":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"description":"FairThreadPoolPool.cpp","created_at":"2012-04-26T13:20:53Z","id":"11cb445f8197e17d303d","html_url":"https://gist.github.com/11cb445f8197e17d303d"}]
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -9,3 +9,14 @@ None
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4967'), ('content-length', '3681'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"5718165cec484b5936e6e08ff24eb2e5"'), ('date', 'Sat, 26 May 2012 10:09:40 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
[{"updated_at":"2012-05-26T10:09:33Z","url":"https://api.github.com/gists/2793179","comments":0,"public":true,"git_pull_url":"git://gist.github.com/2793179.git","git_push_url":"git@gist.github.com:2793179.git","files":{"foobar.txt":{"type":"text/plain","raw_url":"https://gist.github.com/raw/2793179/73a1c7f17aa0ad5d7cbb5a8ca033ce47d3d23197/foobar.txt","size":24,"filename":"foobar.txt","language":"Text"}},"user":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"description":"Gist created by PyGithub","created_at":"2012-05-26T09:50:02Z","id":"2793179","html_url":"https://gist.github.com/2793179"},{"updated_at":"2012-04-26T13:20:53Z","url":"https://api.github.com/gists/11cb445f8197e17d303d","comments":0,"public":false,"git_pull_url":"git://gist.github.com/11cb445f8197e17d303d.git","git_push_url":"git@gist.github.com:11cb445f8197e17d303d.git","files":{"FairThreadPoolPool.cpp":{"type":"text/plain","raw_url":"https://gist.github.com/raw/11cb445f8197e17d303d/0f72c6fe50eb011eacb4e39fa613bdfe2f7a0c51/FairThreadPoolPool.cpp","size":7779,"filename":"FairThreadPoolPool.cpp","language":"C++"}},"user":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"description":"FairThreadPoolPool.cpp","created_at":"2012-04-26T13:20:53Z","id":"11cb445f8197e17d303d","html_url":"https://gist.github.com/11cb445f8197e17d303d"},{"updated_at":"2012-02-29T16:47:12Z","url":"https://api.github.com/gists/1942384","comments":0,"public":true,"git_pull_url":"git://gist.github.com/1942384.git","git_push_url":"git@gist.github.com:1942384.git","files":{"fail_github.py":{"type":"application/python","raw_url":"https://gist.github.com/raw/1942384/2fb3aa84e0efa50dc0f4c18b5df5b7b9ab27076b/fail_github.py","size":1636,"filename":"fail_github.py","language":"Python"}},"user":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"description":"How to error 500 Github API v3, as requested by Rick (GitHub Staff)","created_at":"2012-02-29T16:47:12Z","id":"1942384","html_url":"https://gist.github.com/1942384"},{"updated_at":"2012-02-28T19:44:42Z","url":"https://api.github.com/gists/dcb7de17e8a52b74541d","comments":1,"public":false,"git_pull_url":"git://gist.github.com/dcb7de17e8a52b74541d.git","git_push_url":"git@gist.github.com:dcb7de17e8a52b74541d.git","files":{"cadfael.txt":{"type":"text/plain","raw_url":"https://gist.github.com/raw/dcb7de17e8a52b74541d/48ca696645682d7430d73180814434e0284796b2/cadfael.txt","size":585,"filename":"cadfael.txt","language":"Text"}},"user":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"description":"Cadfael: order of episodes in French DVD edition","created_at":"2012-02-28T19:44:42Z","id":"dcb7de17e8a52b74541d","html_url":"https://gist.github.com/dcb7de17e8a52b74541d"}]
|
||||
|
||||
https
|
||||
GET
|
||||
api.github.com
|
||||
None
|
||||
/users/jacquev6/gists?since=2012-03-01T17%3A00%3A00Z
|
||||
{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
|
||||
None
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4967'), ('content-length', '1811'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"7518615cec183b5396a6e08ef24eb2e9"'), ('date', 'Sat, 26 May 2012 10:10:17 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
[{"updated_at":"2012-05-26T10:09:33Z","url":"https://api.github.com/gists/2793179","comments":0,"public":true,"git_pull_url":"git://gist.github.com/2793179.git","git_push_url":"git@gist.github.com:2793179.git","files":{"foobar.txt":{"type":"text/plain","raw_url":"https://gist.github.com/raw/2793179/73a1c7f17aa0ad5d7cbb5a8ca033ce47d3d23197/foobar.txt","size":24,"filename":"foobar.txt","language":"Text"}},"user":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"description":"Gist created by PyGithub","created_at":"2012-05-26T09:50:02Z","id":"2793179","html_url":"https://gist.github.com/2793179"},{"updated_at":"2012-04-26T13:20:53Z","url":"https://api.github.com/gists/11cb445f8197e17d303d","comments":0,"public":false,"git_pull_url":"git://gist.github.com/11cb445f8197e17d303d.git","git_push_url":"git@gist.github.com:11cb445f8197e17d303d.git","files":{"FairThreadPoolPool.cpp":{"type":"text/plain","raw_url":"https://gist.github.com/raw/11cb445f8197e17d303d/0f72c6fe50eb011eacb4e39fa613bdfe2f7a0c51/FairThreadPoolPool.cpp","size":7779,"filename":"FairThreadPoolPool.cpp","language":"C++"}},"user":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"description":"FairThreadPoolPool.cpp","created_at":"2012-04-26T13:20:53Z","id":"11cb445f8197e17d303d","html_url":"https://gist.github.com/11cb445f8197e17d303d"}]
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
############################ Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2018 itsbruce <it.is.bruce@gmail.com> #
|
||||
# #
|
||||
# This file is part of PyGithub. #
|
||||
# http://pygithub.readthedocs.io/ #
|
||||
# #
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under #
|
||||
# the terms of the GNU Lesser General Public License as published by the Free #
|
||||
# Software Foundation, either version 3 of the License, or (at your option) #
|
||||
# any later version. #
|
||||
# #
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
||||
# details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
################################################################################
|
||||
|
||||
from datetime import datetime, timedelta, tzinfo
|
||||
|
||||
class UTCtzinfo(tzinfo):
|
||||
def utcoffset(self, dt):
|
||||
return timedelta(0)
|
||||
|
||||
def tzname(self, dt):
|
||||
return "UTC"
|
||||
|
||||
def dst(self, dt):
|
||||
return timedelta(0)
|
||||
|
||||
Reference in New Issue
Block a user