Giter Club home page Giter Club logo

python-salesforce-api's People

Contributors

ericbn avatar felixlindstrom avatar mattschofield avatar peteeckel avatar vijayprakashpj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

python-salesforce-api's Issues

SOAP authentication always prints the instance url to STDOUT

I am currently evaluating the module in a monitoring project.

It seems that in login.py a debug print statement was forgotten in the code, so every time a SOAP authentication occurs, the call to soap() results in an erroneous print statement that messes up the output of the calling program.

I'll submit a PR to fix this.

Unable to connect to an Account record

I need to switch a user account for an account record, but most login methods require a combination of username and a password, and I don't have any of those, the only things I have is the consumer key and the consumer secret, is there a way to login just with those attributes?

Request logging level is too low (info, should be debug)

Hi,

First of all thanks a lot for providing such a nice client and making one aspect of the salesforce API simple.

While using the client, the following line is outputting logs that cannot be easily disabled in the logging config. The root logger is being used which means in order to disable this log line, the root logger itself has to switch from INFO to a higher filter.

logging.info('Verb: {verb}, URL: {url}, Result: {result}'.format(

Would it be possible to use a logger specific to the package (e.g "salesforce_api") or reduce this log level to debug?

Cheers

is there a way to just provide csv for bulk upload

hi,
i am using the library. however in my application, i am already getting the csv files. so step for converting csv to json and back to csv is not useful.

is there option to just provide csv name? Here, obviously, it will work only for max-size. we may have to develop function for 'csv-within-limit' and also a splitting.

also, if list of json is provided, does the library handles splitting of records to get the csv only for max allowed size?

regards,
amit

Bulk Job error

Seems like something is wrong with bulk jobs. InProgress jobs get returned as errors.

Starting update
'InProgress' is not a valid JOB_STATE
ValueError: 'InProgress' is not a valid JOB_STATE

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "sfdc.py", line 131, in <module>
    raise e
  File "sfdc.py", line 126, in <module>
    resp = sf.bulk.update('Contact', upd)
  File "/Users/mxk/opt/anaconda3/lib/python3.8/site-packages/salesforce_api/services/bulk/v2.py", line 44, in update
    return self._execute_operation(OPERATION.UPDATE, object_name, entries)
  File "/Users/mxk/opt/anaconda3/lib/python3.8/site-packages/salesforce_api/services/bulk/v2.py", line 58, in _execute_operation
    return job.wait()
  File "/Users/mxk/opt/anaconda3/lib/python3.8/site-packages/salesforce_api/services/bulk/v2.py", line 115, in wait
    while not self.is_done():
  File "/Users/mxk/opt/anaconda3/lib/python3.8/site-packages/salesforce_api/services/bulk/v2.py", line 98, in is_done
    return self.get_state() in JOB_STATES_DONE
  File "/Users/mxk/opt/anaconda3/lib/python3.8/site-packages/salesforce_api/services/bulk/v2.py", line 95, in get_state
    return JOB_STATE(self.info().get('state'))
  File "/Users/mxk/opt/anaconda3/lib/python3.8/enum.py", line 309, in __call__
    return cls.__new__(cls, value)
  File "/Users/mxk/opt/anaconda3/lib/python3.8/enum.py", line 600, in __new__
    raise exc
  File "/Users/mxk/opt/anaconda3/lib/python3.8/enum.py", line 584, in __new__
    result = cls._missing_(value)
  File "/Users/mxk/opt/anaconda3/lib/python3.8/enum.py", line 613, in _missing_
    raise ValueError("%r is not a valid %s" % (value, cls.__name__))
ValueError: 'InProgress' is not a valid JOB_STATE

bulk update documentation

Hi @felixlindstrom
First thank you for sharing this, saved me a lot of time !
It seems there is an issue in https://github.com/felixlindstrom/python-salesforce-api#bulk-update documentation since the update key is not specified.
IMO it should be something like

client.bulk.update('Contact', [
    {'LastName': 'Lindstrom', 'Email': '[email protected]', 'MyId__c': 1},
    {'LastName': 'Something else', 'Email': '[email protected]', 'MyId__c': 2}
], external_id_field='MyId__c')

or

client.bulk.update('Contact', ['0031l000007rU5rAAE', '0031l000007rU5sAAE'], [
    {'LastName': 'Lindstrom', 'Email': '[email protected]'},
    {'LastName': 'Something else', 'Email': '[email protected]'}
])

Could you please take a look ?
Best regards

Bulk V2 API job data is not encoded to UTF-8

Salesforce requires the uploaded data to be encoded as (or at least compatible with) UTF-8. (https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/datafiles_prepare_csv.htm, fourth bullet point from the top). Though, in practice, upload jobs with higher-code-point characters fail in Python before the ingest request can be sent to Salesforce.

The bulk client does not encode the CSV data, which remains as type str until a lower-level package must make an encoding decision. The low-level Python http library sees a str object and tries to make a bytes out of it by encoding to the HTTP-default, ISO-8859-1. But I pass it data that is not compatible with that encoding, so it raises a UnicodeEncodeError.

Here is a contrived example of something that should work but doesn't:

salesforce.bulk.insert('Contact', [
    {'FirstName': 'Σόλων', 'LastName': 'Lawgiver', 'AccountID': '000000000000000'},
])

As a workaround, in the codebase I'm working in, I've monkey-patched salesforce_api.services.bulk.v2.Job._prepare_data such that it calls encode('utf-8') and returns bytes. I've not submitted a PR to change this function, as there's a stack of calling functions that all expect str, so encoding then and there may not be the desired long-term fix. But the patch works for now.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.