コード例 #1
0
ファイル: app.py プロジェクト: inkmonk/trellogit
def trello_milestones_board_hook():
    # try:
    #     print os.getcwd()
    #     print os.listdir(".")
    #     with open("record.txt", "w") as fp:
    #         json.dump({
    #             "headers": request.headers,
    #             "data": request.get_json()
    #         }, fp, default=json_encoder)
    #         print request.get_json()
    # except Exception as e:
    #     current_app.logger.exception(e)
    #     traceback.print_exc()
    json_data = request.get_json()
    print json_data
    if json_data is not None and json_data['action']['type'] == 'updateCard':
        action_data = json_data['action']['data']
        card_full_data = trello.get("%s/boards/%s/cards/%s" % (
            trello_api, action_data['board']['id'], action_data['card']['id']))
        print card_full_data
        if action_data['listAfter']['name'] != 'Backlog':
            data = {
                'title': action_data['card']['name']
            }
            resp = github.post("%s/milestones" % github_api, data=data)
            print resp.json()

    return Response(jsoned({'status': 'success'}, wrap=False),
                    200, mimetype='application/json')
コード例 #2
0
ファイル: app.py プロジェクト: inkmonk/trellogit
def github_issues_hook():
    json_data = request.get_json()
    print json_data
    if json_data['action'] == 'closed':
        issue = json_data['issue']
        issue_card = next(
            card for card in initializer.existing_issue_cards
            if card['name'].endswith("#%s" % issue['number']))
        data_to_update = {
            'idList': initializer.tasks_board_lists['Done']
        }
        modified_issue_card = trello.put("%s/cards/%s" % (
            trello_api, issue_card['id']), data=data_to_update).json()
        idx_to_replace = initializer.existing_issue_cards.index(issue_card)
        initializer.existing_issue_cards.pop(idx_to_replace)
        initializer.existing_issue_cards.insert(idx_to_replace, modified_issue_card)

    return Response(jsoned({'status': 'success'}, wrap=False),
                    200, mimetype='application/json')
コード例 #3
0
ファイル: app.py プロジェクト: inkmonk/trellogit
def trello_tasks_hook():
    json_data = request.get_json()
    print json_data
    return Response(jsoned({'status': 'success'}, wrap=False),
                    200, mimetype='application/json')
コード例 #4
0
ファイル: app.py プロジェクト: inkmonk/trellogit
def github_issue_comments_hook():
    json_data = request.get_json()
    print json_data
    return Response(jsoned({'status': 'success'}, wrap=False),
                    200, mimetype='application/json')