当前位置: 首页>>代码示例>>Python>>正文


Python GitHub.users方法代码示例

本文整理汇总了Python中github.GitHub.users方法的典型用法代码示例。如果您正苦于以下问题:Python GitHub.users方法的具体用法?Python GitHub.users怎么用?Python GitHub.users使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.GitHub的用法示例。


在下文中一共展示了GitHub.users方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_gh_data

# 需要导入模块: from github import GitHub [as 别名]
# 或者: from github.GitHub import users [as 别名]
def get_gh_data():
    gh_access_token = request.cookies.get('gh_access_token')
    gh = GitHub(access_token=gh_access_token)

    user_id = gh.user().get()['login']
    page = 1
    events = gh.users(user_id).events().get(page=page)

    while True:
        page += 1        
        new_events = gh.users(user_id).events().get(page=page)
        if len(new_events) > 0:
            events.extend(new_events)
        else:
            break

    created_ats = [e['created_at'][:-1] for e in events]

    timestamps = []
    for ca in created_ats:
        ts = time.strptime(ca, "%Y-%m-%dT%H:%M:%S")
        timestamps.append((ts.tm_hour * 60 + ts.tm_min -300)%1440)

    print("GH: " + str(len(timestamps)))

    return json.dumps(timestamps)
开发者ID:acsalu,项目名称:social-traces,代码行数:28,代码来源:app.py

示例2: GitHubScooper

# 需要导入模块: from github import GitHub [as 别名]
# 或者: from github.GitHub import users [as 别名]
class GitHubScooper(object):

    def __init__(self, type='GitHub', user=None, token=None):
        self.user = user
        self.gh = GitHub(access_token=token)

    def scoop(self):
        result = []
        events = self.gh.users(self.user).events.public.get()
        for event in events:
            hash = sha256()
            hash.update(event['id'].encode())

            result.append(dict(
                checksum=hash.hexdigest(),
                headline='{} event to repo {}'.format(
                    event['type'],
                    event['repo']['name']),
                content='contentfoo',
                pub_date=datetime.strptime(
                    event['created_at'], '%Y-%m-%dT%H:%M:%SZ')))

        return result
开发者ID:geyer-moldfusz,项目名称:gmi.django.scooper,代码行数:25,代码来源:scoop.py

示例3: GitHub

# 需要导入模块: from github import GitHub [as 别名]
# 或者: from github.GitHub import users [as 别名]
from github import GitHub

gh = GitHub()
user = gh.users('stevesun112').get()
#print( user )
commit = gh.repos('imsure', 'hello-antares').commits('083a8604a73dcb5eda83a5bdd6638a93cfa60045').get()
#print( commit[ 'html_url' ] )
search = gh.search.code.get(q="addClass in:file language:js repo:jquery/jquery")
#print( search )
search = gh.search.code.get(q="create_table in:file language:py repo:imsure/hello-antares")
#print( search[ 'items' ][0][ 'html_url' ] )

user = gh.users('AzNOAOTares').get()
print( user )
commit = gh.repos('AzNOAOTares', 'antares-docs').commits('ee22aff520fba4e69971c9ac86a383e0b2374bb6').get()
print( commit[ 'html_url' ] )
# search = gh.search.code.get(q="addClass in:file language:js repo:jquery/jquery")
#print( search )
search = gh.search.code.get(q="maketitle in:file language:tex repo:AzNOAOTares/antares-docs")
print( search[ 'items' ][0][ 'html_url' ] )

user = gh.users('AzNOAOTares').get()
print( user )
commit = gh.repos('AzNOAOTares', 'architecture').commits('93d4c7d2e6d6950dbeebff0de9c33941ecf3d109').get()
print( commit[ 'html_url' ] )
# search = gh.search.code.get(q="addClass in:file language:js repo:jquery/jquery")
#print( search )
#search = gh.search.code.get(q="maketitle in:file language:tex repo:AzNOAOTares/antares-docs")
#print( search[ 'items' ][0][ 'html_url' ] )
开发者ID:imsure,项目名称:antares_provenance_test,代码行数:31,代码来源:github-api-test.py

示例4: GitHub

# 需要导入模块: from github import GitHub [as 别名]
# 或者: from github.GitHub import users [as 别名]
from github import GitHub

if False:
    gh = GitHub("Test")
    res = gh.users('octocats').get()
    print res
else:
    from twisted.internet import threads, reactor, defer
    gh = GitHub("Test", async=True)
    @defer.inlineCallbacks
    def f():
        print "Async"
        res = yield gh.users('octocats').get()
        print res
        reactor.stop()
    f()
    reactor.run()
开发者ID:opencv-infrastructure,项目名称:common-pullrequest-plugin,代码行数:19,代码来源:test.py


注:本文中的github.GitHub.users方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。