Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed the required parameter of async process if from retrieve() #623

Open
wants to merge 4 commits into
base: release/v1.12.6
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions simple_salesforce/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,14 @@ def __init__(
def mdapi(self):
"""Utility to interact with metadata api functionality"""
if not self._mdapi:
self._mdapi = SfdcMetadataApi(session=self.session,
session_id=self.session_id,
instance=self.sf_instance,
metadata_url=self.metadata_url,
api_version=self.sf_version,
headers=self.headers)
self._mdapi = SfdcMetadataApi(
session=self.session,
session_id=self.session_id,
instance=self.sf_instance,
metadata_url=self.metadata_url,
api_version=self.sf_version,
headers=self.headers
)
return self._mdapi

def _generate_headers(self):
Expand Down
34 changes: 31 additions & 3 deletions simple_salesforce/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,34 @@ def get_component_error_count(value):
except ValueError:
return 0

def retrieve_deployment_logs(self, async_process_id, **kwargs):
"""
Retrieves logs back from salesforce for a deployment async ID
:param async_process_id:
"""
client = kwargs.get('client', 'simple_salesforce_metahelper')

attributes = {
'client': client,
'sessionId': self._session_id,
'asyncProcessId': async_process_id,
'includeDetails': 'true'
}
mt_request = CHECK_DEPLOY_STATUS_MSG.format(**attributes)
headers = {
'Content-type': 'text/xml', 'SOAPAction': 'checkDeployStatus'
}

res = call_salesforce(
url=self.metadata_url + 'deployRequest/' + async_process_id,
method='POST',
session=self.session,
headers=self.headers,
additional_headers=headers,
data=mt_request)

return res.text

def check_deploy_status(self, async_process_id, **kwargs):
"""
Checks whether deployment succeeded
Expand Down Expand Up @@ -452,8 +480,8 @@ def download_unit_test_logs(self, async_process_id):
print("response:", ET.tostring(result, encoding="us-ascii",
method="xml"))

def retrieve(self, async_process_id, **kwargs):
""" Submits retrieve request """
def retrieve(self, **kwargs):
"""Submits retrieve request """
# Compose unpackaged XML
client = kwargs.get('client', 'simple_salesforce_metahelper')
single_package = kwargs.get('single_package', True)
Expand Down Expand Up @@ -486,7 +514,7 @@ def retrieve(self, async_process_id, **kwargs):
headers = {'Content-type': 'text/xml', 'SOAPAction': 'retrieve'}

res = call_salesforce(
url=self.metadata_url + 'deployRequest/' + async_process_id,
url=self.metadata_url,
method='POST',
session=self.session,
headers=self.headers,
Expand Down