Skip to content

Commit

Permalink
Merge pull request #4 from trustyou/python3-support
Browse files Browse the repository at this point in the history
Python3 support
  • Loading branch information
bholagabbar committed Jul 19, 2017
2 parents 4d70b8a + 41777d0 commit 78f8d27
Show file tree
Hide file tree
Showing 6 changed files with 287 additions and 128 deletions.
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -11,6 +11,7 @@ The [salesforce-bulk](https://github.com/heroku/salesforce-bulk) library was use
* Added support for parsing unicode characters in CSV
* Explicit [Upsert](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_upsert.htm) Support
* Fixed various other bugs
* Python 3 support

**salesforce-bulkipy** will be actively maintained, unlike salesforce-bulk

Expand Down Expand Up @@ -152,6 +153,6 @@ bulk.close_job(job)

## Credits and Contributions

This repository is a maintained fork of [heroku/salesforce-bulk](https://github.com/heroku/salesforce-bulk). The changes incorporated here are a result of a joint effort by [@lambacck](https://github.com/lambacck), [@Jeremydavisvt](https://github.com/Jeremydavisvt), [@alexhughson](https://github.com/alexhughson) and [@bholagabbar](https://github.com/bholagabbar). Thanks to [@heroku](https://github.com/heroku) for creating the original useful library.
This repository is a maintained fork of [heroku/salesforce-bulk](https://github.com/heroku/salesforce-bulk). The changes incorporated here are a result of a joint effort by [@lambacck](https://github.com/lambacck), [@Jeremydavisvt](https://github.com/Jeremydavisvt), [@alexhughson](https://github.com/alexhughson), [@bholagabbar](https://github.com/bholagabbar) and [@TrustYou](https://github.com/trustyou) ([@xyder](https://github.com/xyder) and [@jeryini](https://github.com/jeryini)). Thanks to [@heroku](https://github.com/heroku) for creating the original useful library.

Feel free to contribute by creating Issues and Pull Requests. We'll test and merge them.
5 changes: 3 additions & 2 deletions salesforce_bulkipy/__init__.py
@@ -1,4 +1,5 @@
from salesforce_bulkipy import SalesforceBulkipy
from csv_adapter import CsvDictsAdapter
from __future__ import absolute_import
from .salesforce_bulkipy import SalesforceBulkipy
from .csv_adapter import CsvDictsAdapter

__version__ = '1.0'
14 changes: 10 additions & 4 deletions salesforce_bulkipy/csv_adapter.py
@@ -1,11 +1,17 @@
from __future__ import absolute_import

import unicodecsv as csv
from cStringIO import StringIO
from future.utils import implements_iterator

from io import BytesIO


@implements_iterator
class CsvDictsAdapter(object):
"""Provide a DataChange generator and it provides a file-like object which returns csv data"""
def __init__(self, source_generator):
self.source = source_generator
self.buffer = StringIO()
self.buffer = BytesIO()
self.csv = None
self.add_header = False

Expand All @@ -15,8 +21,8 @@ def __iter__(self):
def write_header(self):
self.add_header = True

def next(self):
row = self.source.next()
def __next__(self):
row = next(self.source)

self.buffer.truncate(0)
self.buffer.seek(0)
Expand Down

0 comments on commit 78f8d27

Please sign in to comment.