Consts.py
1 ############################ Copyrights and license ############################ 2 # # 3 # Copyright 2013 AKFish <akfish@gmail.com> # 4 # Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> # 5 # Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> # 6 # Copyright 2016 Jakub Wilk <jwilk@jwilk.net> # 7 # Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> # 8 # Copyright 2018 Maarten Fonville <mfonville@users.noreply.github.com> # 9 # Copyright 2018 Wan Liuyang <tsfdye@gmail.com> # 10 # Copyright 2018 sfdye <tsfdye@gmail.com> # 11 # Copyright 2019 Nick Campbell <nicholas.j.campbell@gmail.com> # 12 # Copyright 2020 Pascal Hofmann <mail@pascalhofmann.de> # 13 # # 14 # This file is part of PyGithub. # 15 # http://pygithub.readthedocs.io/ # 16 # # 17 # PyGithub is free software: you can redistribute it and/or modify it under # 18 # the terms of the GNU Lesser General Public License as published by the Free # 19 # Software Foundation, either version 3 of the License, or (at your option) # 20 # any later version. # 21 # # 22 # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY # 23 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # 24 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # 25 # details. # 26 # # 27 # You should have received a copy of the GNU Lesser General Public License # 28 # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. # 29 # # 30 ################################################################################ 31 32 33 REQ_IF_NONE_MATCH = "If-None-Match" 34 REQ_IF_MODIFIED_SINCE = "If-Modified-Since" 35 PROCESSING_202_WAIT_TIME = 2 36 37 # ############################################################################## 38 # Response Header # 39 # (Lower Case) # 40 # ############################################################################## 41 RES_ETAG = "etag" 42 RES_LAST_MODIFIED = "last-modified" 43 44 # Inspired by https://github.com/google/go-github 45 46 # Headers 47 48 headerRateLimit = "x-ratelimit-limit" 49 headerRateRemaining = "x-ratelimit-remaining" 50 headerRateReset = "x-ratelimit-reset" 51 headerOAuthScopes = "x-oauth-scopes" 52 headerOTP = "x-github-otp" 53 54 defaultMediaType = "application/octet-stream" 55 56 # Custom media type for preview API 57 58 # https://developer.github.com/changes/2014-12-09-new-attributes-for-stars-api/ 59 mediaTypeStarringPreview = "application/vnd.github.v3.star+json" 60 61 # https://developer.github.com/changes/2016-02-19-source-import-preview-api/ 62 mediaTypeImportPreview = "application/vnd.github.barred-rock-preview" 63 64 # https://developer.github.com/changes/2016-05-12-reactions-api-preview/ 65 mediaTypeReactionsPreview = "application/vnd.github.squirrel-girl-preview" 66 67 # https://developer.github.com/changes/2016-09-14-Integrations-Early-Access/ 68 mediaTypeIntegrationPreview = "application/vnd.github.machine-man-preview+json" 69 70 # https://developer.github.com/changes/2016-09-14-projects-api/ 71 mediaTypeProjectsPreview = "application/vnd.github.inertia-preview+json" 72 73 # https://developer.github.com/changes/2017-01-05-commit-search-api/ 74 mediaTypeCommitSearchPreview = "application/vnd.github.cloak-preview" 75 76 # https://developer.github.com/changes/2017-02-28-user-blocking-apis-and-webhook/ 77 mediaTypeBlockUsersPreview = "application/vnd.github.giant-sentry-fist-preview+json" 78 79 # https://developer.github.com/changes/2017-07-17-update-topics-on-repositories/ 80 mediaTypeTopicsPreview = "application/vnd.github.mercy-preview+json" 81 82 # https://developer.github.com/changes/2018-02-22-label-description-search-preview/ 83 mediaTypeLabelDescriptionSearchPreview = "application/vnd.github.symmetra-preview+json" 84 85 # https://developer.github.com/changes/2018-01-10-lock-reason-api-preview/ 86 mediaTypeLockReasonPreview = "application/vnd.github.sailor-v-preview+json" 87 88 # https://developer.github.com/changes/2018-01-25-organization-invitation-api-preview/ 89 mediaTypeOrganizationInvitationPreview = "application/vnd.github.dazzler-preview+json" 90 91 # https://developer.github.com/changes/2018-02-07-team-discussions-api 92 mediaTypeTeamDiscussionsPreview = "application/vnd.github.echo-preview+json" 93 94 # https://developer.github.com/changes/2018-03-16-protected-branches-required-approving-reviews/ 95 mediaTypeRequireMultipleApprovingReviews = "application/vnd.github.luke-cage-preview+json" 96 97 # https://developer.github.com/changes/2018-05-24-user-migration-api/ 98 mediaTypeMigrationPreview = "application/vnd.github.wyandotte-preview+json" 99 100 # https://developer.github.com/changes/2019-07-16-repository-templates-api/ 101 mediaTypeTemplatesPreview = "application/vnd.github.baptiste-preview+json" 102 103 # https://docs.github.com/en/rest/reference/search#highlighting-code-search-results-1 104 highLightSearchPreview = "application/vnd.github.v3.text-match+json" 105 106 # https://developer.github.com/changes/2018-02-22-protected-branches-required-signatures/ 107 signaturesProtectedBranchesPreview = "application/vnd.github.zzzax-preview+json" 108 109 # https://developer.github.com/changes/2019-04-24-vulnerability-alerts/ 110 vulnerabilityAlertsPreview = "application/vnd.github.dorian-preview+json" 111 112 # https://developer.github.com/changes/2019-06-04-automated-security-fixes/ 113 automatedSecurityFixes = "application/vnd.github.london-preview+json" 114 115 # https://developer.github.com/changes/2019-05-29-update-branch-api/ 116 updateBranchPreview = "application/vnd.github.lydian-preview+json" 117 118 # https://developer.github.com/changes/2016-05-23-timeline-preview-api/ 119 issueTimelineEventsPreview = "application/vnd.github.mockingbird-preview" 120 121 # https://docs.github.com/en/rest/reference/teams#check-if-a-team-manages-a-repository 122 teamRepositoryPermissions = "application/vnd.github.v3.repository+json" 123 124 # https://developer.github.com/changes/2016-04-06-deployment-and-deployment-status-enhancements/ 125 deploymentEnhancementsPreview = "application/vnd.github.ant-man-preview+json" 126 127 # https://developer.github.com/changes/2018-10-16-deployments-environments-states-and-auto-inactive-updates/ 128 deploymentStatusEnhancementsPreview = "application/vnd.github.flash-preview+json" 129 130 # https://developer.github.com/changes/2019-12-03-internal-visibility-changes/ 131 repoVisibilityPreview = "application/vnd.github.nebula-preview+json" 132 133 DEFAULT_BASE_URL = "https://api.github.com" 134 DEFAULT_STATUS_URL = "https://status.github.com" 135 DEFAULT_USER_AGENT = "PyGithub/Python" 136 # As of 2018-05-17, Github imposes a 10s limit for completion of API requests. 137 # Thus, the timeout should be slightly > 10s to account for network/front-end 138 # latency. 139 DEFAULT_TIMEOUT = 15 140 DEFAULT_PER_PAGE = 30 141 142 # JWT expiry in seconds. Could be set for max 600 seconds (10 minutes). 143 # https://docs.github.com/en/developers/apps/building-github-apps/authenticating-with-github-apps#authenticating-as-a-github-app 144 DEFAULT_JWT_EXPIRY = 300 145 MIN_JWT_EXPIRY = 15 146 MAX_JWT_EXPIRY = 600 147 # https://docs.github.com/en/developers/apps/building-github-apps/authenticating-with-github-apps#generating-a-json-web-token-jwt 148 # "The time the JWT was created. To protect against clock drift, we recommend you set this 60 seconds in the past." 149 DEFAULT_JWT_ISSUED_AT = -60 150 # https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-a-json-web-token-jwt-for-a-github-app 151 # "Your JWT must be signed using the RS256 algorithm" 152 DEFAULT_JWT_ALGORITHM = "RS256" 153 154 # https://docs.github.com/en/rest/guides/best-practices-for-integrators?apiVersion=2022-11-28#dealing-with-secondary-rate-limits 155 DEFAULT_SECONDS_BETWEEN_REQUESTS = 0.25 156 DEFAULT_SECONDS_BETWEEN_WRITES = 1.0