Skip to content

Commit

Permalink
Migrate header variable into rest client
Browse files Browse the repository at this point in the history
  • Loading branch information
Gonchik Tsymzhitov committed Aug 28, 2020
1 parent 82065a1 commit b86c30e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
1 change: 1 addition & 0 deletions atlassian/rest_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class AtlassianRestAPI(object):
form_token_headers = {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'X-Atlassian-Token': 'no-check'}
no_check_headers = {'X-Atlassian-Token': 'no-check'}
experimental_headers_general = {'X-Atlassian-Token': 'no-check', 'X-ExperimentalApi': 'opt-in'}
response = None

def __init__(self, url, username=None, password=None, timeout=60, api_root='rest/api', api_version='latest',
Expand Down
5 changes: 1 addition & 4 deletions atlassian/service_desk.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,7 @@ def attach_temporary_file(self, service_desk_id, filename):
url = 'rest/servicedeskapi/servicedesk/{}/attachTemporaryFile'.format(service_desk_id)

with open(filename, 'rb') as file:
headers = {
'X-Atlassian-Token': 'no-check',
'X-ExperimentalApi': 'opt-in'}
result = self.post(path=url, headers=headers,
result = self.post(path=url, headers=self.experimental_headers_general,
files={'file': file}).get('temporaryAttachments')
temp_attachment_id = result[0].get('temporaryAttachmentId')

Expand Down

0 comments on commit b86c30e

Please sign in to comment.