python-pipedrive icon indicating copy to clipboard operation
python-pipedrive copied to clipboard

Deleting organization is not working.

Open ishsonya opened this issue 6 years ago • 0 comments

pipedrive.Pipedrive(token).organizations({"id": org_id}, method='DELETE')

yields an error: Please provide at least one item to delete

Looks it's because id is not handled properly in 'delete' requests. There are issued with bulk deletes as well (None of sent ids are deleted) adding

elif method == 'DELETE':
    if 'id' in data:
        putid = data.pop('id')
        uri = '{0}{1}/{2}?api_token={3}'.format(PIPEDRIVE_API_URL, endpoint, str(putid), str(self.api_token))
    response, data = self.http.request(uri, method=method, body=urlencode(data),
                                               headers={'Content-Type': 'application/x-www-form-urlencoded'})

to Pipedrive._request makes it work

ishsonya avatar Jun 08 '19 12:06 ishsonya