Wednesday, 15 July 2015

python - Wrapping a file in JSON -



python - Wrapping a file in JSON -

i have code send info sugarcrm in python, seems work. problem comes when seek send file, needs wrapped in json object:

import sugarcrm sugarcrm_user = "user" sugarcrm_pass = "pass" sugarcrm_url = "http://url/rest.php" sugarcrm_conn= none try: sugarcrm_conn = sugarcrm.sugarcrm(url = sugarcrm_url, username = sugarcrm_user, password = sugarcrm_pass) new_account = sugarcrm_conn.set_entry('test_images',{'uploadfile' : 'adsfsdf'}) except valueerror: print "can't connect " + sugarcrm_url exit(1)

is there way of placing file in json object, can send sugar? or there improve ways of doing this?

i can add together file manually using sugarcrm in browser, sending file proving difficult. far can tell, encoding file before sending it, stores encoded string - no decoding taking place.

python json python-2.7 sugarcrm

No comments:

Post a Comment