Skip to content

Commit 050087c

Browse files
Gonchik TsymzhitovGonchik Tsymzhitov
authored andcommitted
Add parameter in rest client. For export methods it is need
1 parent aaff2a5 commit 050087c

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

atlassian/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.10.0
1+
1.10.1

atlassian/jira.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,3 +467,12 @@ def tempo_account_delete_customer_by_id(self, customer_id=1):
467467
"""
468468
url = 'rest/tempo-accounts/1/customer/{id}'.format(id=customer_id)
469469
return self.delete(url)
470+
471+
def tempo_account_export_accounts(self):
472+
"""
473+
Get csv export file of Accounts from Tempo
474+
:return: csv file
475+
"""
476+
headers = {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'X-Atlassian-Token': 'no-check'}
477+
url = 'rest/tempo-accounts/1/export'
478+
return self.get(url, headers=headers, not_json_response=True)

atlassian/rest_client.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,21 @@ def request(self, method='GET', path='/', data=None, flags=None, params=None, he
8484
log.error('Response is: {content}'.format(content=err.response.content))
8585
return response
8686

87-
def get(self, path, data=None, flags=None, params=None, headers=None):
88-
return self.request('GET', path=path, flags=flags, params=params, data=data, headers=headers).json()
87+
def get(self, path, data=None, flags=None, params=None, headers=None, not_json_response=None):
88+
"""
89+
Get request based on the python-requests module. You can override headers, and also, get not json response
90+
:param path:
91+
:param data:
92+
:param flags:
93+
:param params:
94+
:param headers:
95+
:param not_json_response: OPTIONAL: For get content from raw requests packet
96+
:return:
97+
"""
98+
if not_json_response:
99+
return self.request('GET', path=path, flags=flags, params=params, data=data, headers=headers).content
100+
else:
101+
return self.request('GET', path=path, flags=flags, params=params, data=data, headers=headers).json()
89102

90103
def post(self, path, data=None, headers=None, files=None):
91104
try:

0 commit comments

Comments
 (0)