How do I find the salesforce package prefix using the sforce or suds python libraries?
Question: I need to update some custom fields of `salesforce` objects. For that I am
trying to use the `upsert` method. I am little confused on choosing the
module; `SforceEnterpriseClient` or `SforcePartnerClient` of `sforce`. I think
I am gonna need the name of the `package prefix` first to `upsert`. I need to
do these things using `sforce` or `suds`. A little explanation on the `sforce`
and `suds` tricks will be helpful.


Answer: Did you try [beatbox](http://code.google.com/p/salesforce-beatbox/) library ?
It is simpler than salesforce-python-toolkit

[This is a full sample](http://code.google.com/p/salesforce-
beatbox/source/browse/trunk/examples/demo.py) of how to upsert a custom field:

    
    
    import sys
    import beatbox
    import xmltramp
    import datetime
    
    sf = beatbox._tPartnerNS
    svc = beatbox.Client()
    class BeatBoxDemo:
            def login(self, username, password):
                    self.password = password
                    loginResult = svc.login(username, password)
                    print "sid = " + str(loginResult[sf.sessionId])
                    print "welcome " + str(loginResult[sf.userInfo][sf.userFullName])
            def upsert(self):
                    print "\nupsert"
                    t = { 'type': 'Task', 
                              'ChandlerId__c': '12345', 
                              'subject': 'BeatBoxTest updated', 
                              'ActivityDate' : datetime.date(2006,2,20) }
    
                    ur = svc.upsert('ChandlerId__c', t)
                    print str(ur[sf.success]) + " -> " + str(ur[sf.id])
    
                    t = {   'type': 'Event', 
                            'ChandlerId__c': '67890', 
                            'durationinminutes': 45, 
                            'subject': 'BeatBoxTest', 
                            'ActivityDateTime' : datetime.datetime(2006,2,20,13,30,30),
                            'IsPrivate': False }
                    ur = svc.upsert('ChandlerId__c', t)
                    if str(ur[sf.success]) == 'true':
                            print "id " + str(ur[sf.id])
                    else:
                            print "error " + str(ur[sf.errors][sf.statusCode]) + ":" +        str(ur[sf.errors][sf.message])
    
    if __name__ == "__main__":
    
            if len(sys.argv) != 3:
                    print "usage is demo.py <username> <password>"
            else:
                    demo = BeatBoxDemo()
                    demo.login(sys.argv[1], sys.argv[2])       
                    demo.upsert()
    

