Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

docs: How to use requests-cache together with gitlab? #690

Open
Labels
@jhermann

Description

@jhermann

This shows how to usereclosedev/requests-cache and could be added to the FAQs. Want a PR?

importgitlabasglapiGITLAB_URL="https://…"classGitLab(glapi.Gitlab):""" GitLab API.        * https://python-gitlab.readthedocs.io/en/stable/api/gitlab.html        * https://docs.gitlab.com/ce/api/#resources    """API_BASEURL=GITLAB_URLCACHE_EXPIRATION=2*60*60# secondsdef__init__(self):account,token=security.Credentials(self.API_BASEURL).auth_pair()session=requests_cache.CachedSession(cache_name=config.cache_file(type(self).__name__),expire_after=self.CACHE_EXPIRATION)withsession.cache_disabled():super().__init__(self.API_BASEURL,private_token=token,session=session)defauth(self):""" Performs a non-cached authentication.        """withself.session.cache_disabled():returnsuper().auth()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp