Skip to content

Added ability to pass custom headers #92

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

Open
wants to merge 3 commits into
base: main
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
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
1.0.8
- Includes Upsert support
- Allow API version to be specified by the caller
2.2.1
- Added support for adding custom headers
6 changes: 5 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Same example but for CSV:
.. code-block:: python

import unicodecsv

job = bulk.create_query_job("Contact", contentType='CSV')
batch = bulk.query(job, "select Id,LastName from Contact")
bulk.close_job(job)
Expand Down Expand Up @@ -114,6 +114,10 @@ Additionally if you want to do something more sophisticated you can provide a he

``bulk.create_query_job(object_name, contentType='CSV', pk_chunking='chunkSize=50000; startRow=00130000000xEftMGH')``

Additionally if you want to set a http header yourself, you can pass a list of custom header values that will be added to the create job salesforce bulk api call:

``bulk.create_query_job(object_name, contentType='CSV', pk_chunking='chunkSize=50000; startRow=00130000000xEftMGH', extra_headers={'Sforce-Disable-Batch-Retry':'TRUE'})``

Bulk Insert, Update, Delete
---------------------------

Expand Down
2 changes: 1 addition & 1 deletion salesforce_bulk/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.2.0rc1'
__version__ = '2.2.1'
7 changes: 5 additions & 2 deletions salesforce_bulk/salesforce_bulk.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,14 @@ def create_delete_job(self, object_name, **kwargs):
return self.create_job(object_name, "delete", **kwargs)

def create_job(self, object_name=None, operation=None, contentType='CSV',
concurrency=None, external_id_name=None, pk_chunking=False):
concurrency=None, external_id_name=None, pk_chunking=False,
extra_headers=None):
assert(object_name is not None)
assert(operation is not None)

extra_headers = {}
if(extra_headers is None):
extra_headers = {}

if pk_chunking:
if pk_chunking is True:
pk_chunking = u'true'
Expand Down