{ "info": { "author": "Miguel Ferrer", "author_email": "ingferrermiguel@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# salesforce-python\n\nsalesforce-python is an API wrapper for Salesforce written in Python\n\n## Installing\n```\npip install salesforce-python\n```\n\n## Usage\n```\nfrom salesforce.client import Client\n\nclient = Client('CLIENT_KEY', 'CLIENT_SECRET', 'https://na50.salesforce.com/', 'v41.0') # Host must have trailing slash\n```\n\nGet authorization url\n```\nurl = client.authorization_url('REDIRECT_URI')\n```\n\nExchange the code for a token\n```\ntoken = client.exchange_code('REDIRECT_URI', 'CODE')\n```\n\nSet the token\n```\nclient.set_access_token('TOKEN')\n```\n\nRefresh the token\n```\nnew_token = client.refresh_token()\n```\n\nGet user information\n```\nuser = client.get_user_info()\n```\n\nGet API versions\n```\nuser = client.get_versions()\n```\n\nGet all resources by the version specified in the client instantiation.\n```\nversions = client.get_versions()\n```\n\nGet all objects described\n```\nmetadata = client.get_describe_global()\n```\n\nGet an object\n```\nobject = client.get_sobject('Lead)\n```\n\nCreate an object\n```\ndata = {'LastName': 'Doe', 'IsConverted': 'False', 'Status': 'Open - Not Contacted', 'IsUnreadByOwner': 'False', 'Company': 'NA', 'FirstName': 'John'}\nresponse = client.create_sobject('Lead', data)\n```\n\nGet an object described\n```\nmetadata = client.get_sobject_describe('Lead')\n```\n\n### Webhooks\nIn order to create a webhook in Salesforce we need to create an APEX Class, Remote Site and Apex Trigger.\n\nCreate the APEX Class\n```\nIn this example we are going to read the apex_class.txt file in the files folder included in this repository:\n\nwith open(os.path.join('/path/to/apex_class.txt'), 'r') as file:\n body = file.read()\n\nresponse = client.create_apex_class('WebhookClass', body)\n```\n\nCreate the Remote Site\n```\nURL is a string with the domain of your site:\n\nurl = 'https://mywebsite.com/'\nresponse = client.create_remote_site('RemoteSiteSetting', url)\n```\n\nCreate the APEX Trigger\n```\nTo create the Trigger, we are going to read the apex_trigger.txt file and replace some values.\n\nwith open(os.path.join('/path/to/apex_trigger.txt'), 'r') as file:\n body = file.read()\n\nsobject = 'User'\nevent = 'after insert'\nurl = 'https://mywebsite.com/notification_url/' #This is the domain url + your webhook path\n\nbody = body.replace('{sobject}', sobject)\nbody = body.replace('{events}', event)\nbody = body.replace('{url}', \"'\" + url + \"'\")\n\nresponse = client.create_apex_trigger('WebhookTrigger', body, sobject)\n```\n\nThat's all, you should receive notifications every time you create a new user in your Salesforce dashboard.\n\n## Requirements\n- requests", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/GearPlug/salesforce-python", "keywords": "", "license": "GPL", "maintainer": "", "maintainer_email": "", "name": "salesforce-python", "package_url": "https://pypi.org/project/salesforce-python/", "platform": "", "project_url": "https://pypi.org/project/salesforce-python/", "project_urls": { "Homepage": "https://github.com/GearPlug/salesforce-python" }, "release_url": "https://pypi.org/project/salesforce-python/0.3.2/", "requires_dist": null, "requires_python": "", "summary": "API wrapper for Salesforce written in Python", "version": "0.3.2" }, "last_serial": 4305157, "releases": { "0.2": [ { "comment_text": "", "digests": { "md5": "cd5ed6d8fe1f935ecaf3243d93669393", "sha256": "336a619fa7958c2378f5fa81b5d09805f9982f64676c2ca848ad63093d69eccb" }, "downloads": -1, "filename": "salesforce-python-0.2.tar.gz", "has_sig": false, "md5_digest": "cd5ed6d8fe1f935ecaf3243d93669393", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2841, "upload_time": "2018-02-15T19:28:59", "url": "https://files.pythonhosted.org/packages/98/93/0baf4fa4d5083dd1dd5b5b3189c4f11be8e7ce4e1d0491f10de0570d9d07/salesforce-python-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "fd513b80baca6553284d2400f26e47fb", "sha256": "0032bdc987e92dca31d34ca2459137e1627512f9347402cabd2c43786be252c1" }, "downloads": -1, "filename": "salesforce-python-0.3.tar.gz", "has_sig": false, "md5_digest": "fd513b80baca6553284d2400f26e47fb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2852, "upload_time": "2018-02-15T21:06:13", "url": "https://files.pythonhosted.org/packages/56/aa/c5290d51f92b3a8265bc0ba7df9f0918c727cce0109c3d12dd4c2b3095f9/salesforce-python-0.3.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "7f99fc62e8b97a6e5be4baba83891955", "sha256": "82ce832a411e8bdcf7801d354a8b8bc0b546c6fecefa876cbc058f51ba4167ff" }, "downloads": -1, "filename": "salesforce-python-0.3.1.tar.gz", "has_sig": false, "md5_digest": "7f99fc62e8b97a6e5be4baba83891955", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4221, "upload_time": "2018-02-26T13:14:06", "url": "https://files.pythonhosted.org/packages/60/b7/518a03f867f334d1e373aa11b56117ec664835f970cf324c22f9fa684d0b/salesforce-python-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "4f89218333b493cc2c45c7495b48016c", "sha256": "0e14855ed5ef2a74c0f6861443c24db2367d4dcc8e90ddaedbd2302f14d8823f" }, "downloads": -1, "filename": "salesforce-python-0.3.2.tar.gz", "has_sig": false, "md5_digest": "4f89218333b493cc2c45c7495b48016c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4193, "upload_time": "2018-09-24T15:39:04", "url": "https://files.pythonhosted.org/packages/94/7b/3ce89ccf3efcd152e841c98d943421a513a13e10962c368bcb5ecfec14cd/salesforce-python-0.3.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4f89218333b493cc2c45c7495b48016c", "sha256": "0e14855ed5ef2a74c0f6861443c24db2367d4dcc8e90ddaedbd2302f14d8823f" }, "downloads": -1, "filename": "salesforce-python-0.3.2.tar.gz", "has_sig": false, "md5_digest": "4f89218333b493cc2c45c7495b48016c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4193, "upload_time": "2018-09-24T15:39:04", "url": "https://files.pythonhosted.org/packages/94/7b/3ce89ccf3efcd152e841c98d943421a513a13e10962c368bcb5ecfec14cd/salesforce-python-0.3.2.tar.gz" } ] }