Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 80e07121 authored by fandrem's avatar fandrem
Browse files

leankit/added in the leankit py library the card, board endpoint support fixes #25751

parent 9911968d
No related branches found
No related tags found
No related merge requests found
...@@ -64,6 +64,11 @@ def get_cardtype_from_board(board_id): ...@@ -64,6 +64,11 @@ def get_cardtype_from_board(board_id):
return api._get('/io/board/' + board_id + '/cardType') return api._get('/io/board/' + board_id + '/cardType')
def update_card(card_id, dcard):
log.debug('Updating card')
return api._patch('/io/card/' + card_id, dcard)
''' '''
def get_newer_if_exists(board_id, version, timezone='UTC'): def get_newer_if_exists(board_id, version, timezone='UTC'):
""" Downloads a board if a newer version number exists """ """ Downloads a board if a newer version number exists """
......
...@@ -37,6 +37,7 @@ class Leankit(object): ...@@ -37,6 +37,7 @@ class Leankit(object):
msg = 'Server responded with code {0.status_code}'.format(request) msg = 'Server responded with code {0.status_code}'.format(request)
raise ConnectionError(msg) raise ConnectionError(msg)
def _post(self, url, params): def _post(self, url, params):
log.debug('POST {}'.format(url)) log.debug('POST {}'.format(url))
print('POST {}'.format(url)) print('POST {}'.format(url))
...@@ -74,5 +75,42 @@ class Leankit(object): ...@@ -74,5 +75,42 @@ class Leankit(object):
raise ConnectionError(msg) raise ConnectionError(msg)
def _patch(self, url, params):
log.debug('PATCH {}'.format(url))
print('PATCH {}'.format(url))
print(params)
try:
request = self.session.patch(self.base + url, json=params, verify=True, headers=self.headers, proxies=self.proxies)
except Exception as error:
raise ConnectionError("Unable to make request: {}".format(error))
if request.ok:
try:
response = request.json()
return response
'''
else:
msg = "Error {ReplyCode}: {ReplyText}".format(**response)
raise ConnectionError(msg)
'''
except ValueError:
raise IOError("Invalid response")
else:
print(request.status_code)
print(request.content)
print('Playload:%s' % (json_dumps(params, sort_keys=True, indent=4)))
try:
print('HEADERS:' % (pformat(request.headers)))
except:
pass
try:
print('TEXT:' % (pformat(request.text)))
except:
pass
msg = 'Server responded with code {0.status_code}'.format(request)
raise ConnectionError(msg)
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
api = Leankit() api = Leankit()
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# User Input
http_proxy = 'http://x50l002:x52503@vip-proxy-l4s.snmc.cec.eu.int:8012'
domain = 'globalntt'
bearer = '60079cf1ec229ea10adea535b04db2ac4c50146f260095ac983b3df9309f9e04e2cd6d4f23d98664503e093aad12ca6f40401d8b2d2b6f75e100d9f51a94bbd1'
# End User Input
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment