mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Initial solution for [PyGithub support for projects](https://github.com/PyGithub/PyGithub/issues/606) (#606). Adds comprehensive project querying API. Currently does not support for modifying projects, columns or cards. (I only need this interface for reporting purposes. Of course once I'm done others are more than welcome to add additional features!) API that was integrated: https://developer.github.com/v3/projects https://developer.github.com/v3/projects/columns https://developer.github.com/v3/projects/cards Note that the Github project API is in preview mode - it requires a special header in order for requests to be processed, and the API is subject to change without notice. ## Summary - new classes: Project, ProjectColumn, ProjectCard - add Organization.get_projects method - add Repository.get_projects method - add MainClass.get_project method - add test cases to exercise all new classes and methods and verify attributes are as expected; replay data is included, recorded (mostly) from my fork of PyGithub - updated add_attribute script to: - use makeXXXAttribute API - be able to add to the end of the current set of properties - handle both Completable and NonCompletable class types correctly ## Checklist Not to be merged until these are done: - [x] remaining Project properties - [x] remaining ProjectColumn properties - [x] remaining ProjectCard properties - [x] support for archived_state parameter when getting cards: all,archived, or not_archived - [x] get issue from card, not just pull request ("get_content" method?) - [x] centralize header management for "preview" access to projects API - [x] add test for retrieving organization projects - [x] add test for getting issue / pull request content from card
92 lines
4.8 KiB
Python
92 lines
4.8 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
############################ Copyrights and license ############################
|
|
# #
|
|
# Copyright 2013 AKFish <akfish@gmail.com> #
|
|
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
|
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
|
# Copyright 2016 Jakub Wilk <jwilk@jwilk.net> #
|
|
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
|
# Copyright 2018 Maarten Fonville <mfonville@users.noreply.github.com> #
|
|
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
|
# Copyright 2018 sfdye <tsfdye@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/>. #
|
|
# #
|
|
################################################################################
|
|
|
|
|
|
REQ_IF_NONE_MATCH = "If-None-Match"
|
|
REQ_IF_MODIFIED_SINCE = "If-Modified-Since"
|
|
PROCESSING_202_WAIT_TIME = 2
|
|
|
|
# ##############################################################################
|
|
# Response Header #
|
|
# (Lower Case) #
|
|
# ##############################################################################
|
|
RES_ETAG = "etag"
|
|
RES_LAST_MODIFIED = "last-modified"
|
|
|
|
# Inspired by https://github.com/google/go-github
|
|
|
|
# Headers
|
|
|
|
headerRateLimit = "x-ratelimit-limit"
|
|
headerRateRemaining = "x-ratelimit-remaining"
|
|
headerRateReset = "x-ratelimit-reset"
|
|
headerOTP = "X-GitHub-OTP"
|
|
|
|
defaultMediaType = "application/octet-stream"
|
|
|
|
# Custom media type for preview API
|
|
|
|
# https://developer.github.com/changes/2014-12-09-new-attributes-for-stars-api/
|
|
mediaTypeStarringPreview = "application/vnd.github.v3.star+json"
|
|
|
|
# https://developer.github.com/changes/2016-02-19-source-import-preview-api/
|
|
mediaTypeImportPreview = "application/vnd.github.barred-rock-preview"
|
|
|
|
# https://developer.github.com/changes/2016-05-12-reactions-api-preview/
|
|
mediaTypeReactionsPreview = "application/vnd.github.squirrel-girl-preview"
|
|
|
|
# https://developer.github.com/changes/2016-09-14-Integrations-Early-Access/
|
|
mediaTypeIntegrationPreview = "application/vnd.github.machine-man-preview+json"
|
|
|
|
# https://developer.github.com/changes/2016-09-14-projects-api/
|
|
mediaTypeProjectsPreview = "application/vnd.github.inertia-preview+json"
|
|
|
|
# https://developer.github.com/changes/2017-01-05-commit-search-api/
|
|
mediaTypeCommitSearchPreview = "application/vnd.github.cloak-preview"
|
|
|
|
# https://developer.github.com/changes/2017-02-28-user-blocking-apis-and-webhook/
|
|
mediaTypeBlockUsersPreview = "application/vnd.github.giant-sentry-fist-preview+json"
|
|
|
|
# https://developer.github.com/changes/2017-07-17-update-topics-on-repositories/
|
|
mediaTypeTopicsPreview = "application/vnd.github.mercy-preview+json"
|
|
|
|
# https://developer.github.com/changes/2018-02-22-label-description-search-preview/
|
|
mediaTypeLabelDescriptionSearchPreview = "application/vnd.github.symmetra-preview+json"
|
|
|
|
# https://developer.github.com/changes/2018-01-10-lock-reason-api-preview/
|
|
mediaTypeLockReasonPreview = "application/vnd.github.sailor-v-preview+json"
|
|
|
|
# https://developer.github.com/changes/2018-01-25-organization-invitation-api-preview/
|
|
mediaTypeOrganizationInvitationPreview = "application/vnd.github.dazzler-preview+json"
|
|
|
|
# https://developer.github.com/changes/2018-03-16-protected-branches-required-approving-reviews/
|
|
mediaTypeRequireMultipleApprovingReviews = "application/vnd.github.luke-cage-preview+json"
|