Exemple #1
0
    def post(self):
        user = request._internal["user"]
        logger.info(
            "[Busy-Beaver] Post GitHub Summary Request -- login successful",
            extra={"user": user.username},
        )

        # TODO: replace this with marshmallow
        data = request.json
        if not data or "channel" not in data:
            logger.error(
                "[Busy-Beaver] Post GitHub Summary Task -- channel in body")
            return make_response(
                422, error={"message": "JSON requires 'channel' key"})
        start_post_github_summary_task(user, data["channel"])

        logger.info("[Busy-Beaver] Post GitHub Summary -- kicked-off")
        return make_response(200, json={"run": "complete"})
Exemple #2
0
 def post(self):
     user = request._internal["user"]
     logger.info(
         "[Busy Beaver] YouTube Video Poll -- login successful",
         extra={"user": user.username},
     )
     data = request.json
     if not data or "channel" not in data:
         logger.error(
             "[Busy Beaver] YouTube Video Poll -- need channel in JSON body"
         )
         return make_response(400,
                              json={"run": "incomplete"},
                              error="Missing Channel")
     self.channel = data["channel"]
     youtube = YouTubeClient(api_key=config.YOUTUBE_API_KEY)
     videos = youtube.get_latest_videos_from_channel(config.YOUTUBE_CHANNEL)
     self.parse_and_post_videos(videos)
     return make_response(200, json={"run": "complete"})
Exemple #3
0
    def post(self):
        user = request._internal["user"]
        logger.info(
            "[Busy-Beaver] Twitter Summary Poll -- login successful",
            extra={"user": user.username},
        )

        # TODO: replace this with marshmallow
        data = request.json
        if not data or "channel" not in data:
            logger.error(
                "[Busy-Beaver] Twitter Summary Poll -- need channel in JSON body"
            )
            return make_response(
                422, error={"message": "JSON requires 'channel' key"})
        start_post_tweets_to_slack_task(user, channel_name=data["channel"])

        logger.info("[Busy-Beaver] Twitter Summary Poll -- kicked-off")
        return make_response(200, json={"run": "complete"})
Exemple #4
0
    def post(self):
        user = request._internal["user"]
        logger.info(
            "[Busy Beaver] Add New Events Poll -- login successful",
            extra={"user": user.username},
        )

        start_sync_event_database_task(user)

        logger.info("[Busy Beaver] Add New Events Poll -- kicked-off")
        return make_response(200, json={"run": "complete"})
Exemple #5
0
    def post(self):
        user = request._internal["user"]
        logger.info(
            "[Busy Beaver] Post Upcoming Events -- login successful",
            extra={"user": user.username},
        )

        # TODO: replace this with marshmallow
        data = request.json
        if not data or "channel" not in data:
            logger.error(
                "[Busy Beaver] Post Upcoming Events -- need channel in JSON body"
            )
            return make_response(422, error={"message": "JSON requires 'channel' key"})
        post_upcoming_events_message_to_slack(
            channel=data["channel"], group_name="ChiPy", count=5
        )

        logger.info("[Busy Beaver] Post Upcoming Events -- complete")
        return make_response(200, json={"run": "complete"})
Exemple #6
0
    def post(self):
        user = request._internal["user"]
        logger.info(
            "[Busy Beaver] Post GitHub Summary Request -- login successful",
            extra={"user": user.username},
        )

        # TODO: replace this with marshmallow
        # Get workspace_id and pass it into github_summary task
        data = request.json
        if not data or "workspace_id" not in data:
            logger.error(
                "[Busy Beaver] Post GitHub Summary Task -- workspace_id missing"
            )
            return make_response(
                status_code=422,
                error={"message": "JSON requires 'workspace_id' key"})
        start_post_github_summary_task(user, data["workspace_id"])

        logger.info("[Busy Beaver] Post GitHub Summary -- kicked-off")
        return make_response(200, json={"run": "complete"})