{ "info": { "author": "ryanss", "author_email": "ryanssdev@icloud.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.5", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Office/Business :: Groupware", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "========\nSugarCRM\n========\n\nPython client for SugarCRM API.\n\n.. image:: http://img.shields.io/pypi/v/sugarcrm.svg\n :target: https://pypi.python.org/pypi/sugarcrm\n\n.. image:: http://img.shields.io/pypi/dm/sugarcrm.svg\n :target: https://pypi.python.org/pypi/sugarcrm\n\n.. image:: http://img.shields.io/pypi/l/sugarcrm.svg\n :target: https://github.com/ryanss/sugarcrm/blob/master/LICENSE\n\n\nExample Usage\n-------------\n\n.. code-block:: python\n\n import sugarcrm\n\n # Connect\n url = \"http://your-sugarcrm-domain/service/v4/rest.php\"\n session = sugarcrm.Session(url, username, password)\n\n # Create a new note\n note = sugarcrm.Note(name=\"Test Note\")\n\n # Save note\n session.set_entry(note)\n\n # Add attachment to note\n session.set_note_attachment(note, \"sugarcrm.py\")\n\n # Query for all notes that have a name that begins with \"Test\"\n note_query = sugarcrm.Note(name=\"Test%\")\n results = session.get_entry_list(note_query)\n\n # Query for all contacts with the first name \"Mylee\"\n contact_query = sugarcrm.Contact(first_name=\"Mylee\")\n results = session.get_entry_list(contact_query)\n\n # Get the email address for the user assigned to an Opportunity\n op = session.get_entry(\"Opportunities\", \"82f72939-735e-53a2-0944-5418c4edae2a\")\n user = session.get_entry(\"Users\", op.assigned_user_id)\n print user.email1\n\n # Change the status of an Opportunity\n op = sugarcrm.Opportunity(id=\"82f72939-735e-53a2-0944-5418c4edae2a\")\n op.sales_stage = \"Approved\"\n session.set_entry(op)\n\n # Extract all non-empty email fields from all Contacts in SugarCRM\n emails = set()\n contact_query = sugarcrm.Contact() # No filters provider finds all objects\n contact_count = session.get_entries_count(contact_query, deleted=True)\n print \"Extracting emails from %d Contacts\" % contact_count\n # Grab 100 Contact objects at a time from SugarCRM\n for offset in range(0, count, 100):\n contacts = session.get_entry_list(contact_query, deleted=True,\n max_results=100, offset=offset)\n for contact in contacts:\n for field in dir(contact):\n if field.find(\"email\") >= 0 and getattr(contact, field, \"\").find(\"@\") >= 0:\n emails.add(getattr(contact, field).lower())\n print \"Found %d emails\" % len(emails)\n\n\nInstall\n-------\n\nThe latest stable version can always be installed or updated via pip:\n\n.. code-block:: bash\n\n $ pip install sugarcrm\n\nIf the above fails, please use easy_install instead:\n\n.. code-block:: bash\n\n $ easy_install sugarcrm\n\n\nSession Object\n--------------\n\nclass sugarcrm.Session(url, username, password, app=\"Python\", lang=\"en_us\", verify=True)\n The main class used to connect to the SugarCRM API and make requests with.\n\n.. code-block:: python\n\n url = \"http://your-sugarcrm-domain/service/v4/rest.php\"\n session = sugarcrm.Session(url, username, password)\n\nThe **verify** parameter is passed directly to the python-requests library that is used to make HTTP POST requests to the SugarCRM API. Read more about this parameter from the python-requests documentation: http://docs.python-requests.org/en/latest/user/advanced/#ssl-cert-verification\n\n\nAvailable Methods\n-----------------\n\nget_available_modules(filter=\"default\")\n Retrieves a list of available modules in the system.\n Possible filter values: \"default\", \"mobile\", \"all\"\n\n.. code-block:: python\n\n modules = session.get_available_modules()\n for m in modules:\n print m.module_key\n\nget_entry(module, object_id, links={}, track_view=False)\n Retrieves a single object based on object ID.\n\n.. code-block:: python\n\n note = session.get_entry(\"Notes\", \"f0c78aab-e051-174a-12aa-5439a7146977\")\n print note.name\n\n # Get a lead and specific fields from linked contacts in one query\n links = {'Contacts': ['id', 'first_name', 'last_name']}\n lead = session.get_entry(\"Leads\", \"d7dac88d-ce33-d98a-da8b-5418bba9e664\",\n links=links)\n for c in lead.contacts:\n print c.id, c.first_name, c.last_name\n\nget_entries(module, object_ids, track_view=False)\n Retrieves a list of objects based on specified object IDs.\n\n.. code-block:: python\n\n ids = [\n \"f0c78aab-e051-174a-12aa-5439a7146977\",\n \"32f02fj2-4ggn-4nnf-fs33-f3fh3f93n333\",\n \"82f72939-735e-53a2-0944-5418c4edae2a\",\n ]\n notes = session.get_entries(\"Notes\", ids)\n for note in notes:\n print note.name\n\nget_entries_count(query_object, deleted=False)\n Retrieves a count of beans based on query specifications.\n\n.. code-block:: python\n\n # Get a count of all Contacts with a first name of \"Fred\"\n # and include Contacts that have been deleted\n contact_query = sugarcrm.Contact(first_name=\"Fred\")\n contacts = session.get_entries_count(contact_query, deleted=True)\n for contact in contacts:\n print contact.first_name, contact.last_name\n\nget_entry_list(query_object, fields=[], links={}, order_by=\"\", max_results=0, offset=0, deleted=False, favorites=False)\n Retrieves a list of objects based on query specifications.\n\n.. code-block:: python\n\n # Get a list of all Notes with a name that begins with \"Test\"\n note_query = sugarcrm.Note(name=\"Test%\")\n notes = session.get_entry_list(note_query)\n for note in notes:\n print note.name\n\n # Get a list of all Opportunities created since Sept 1, 2014 and include\n # data about link contacts with each Opportunitity returned\n q = sugarcrm.Opportunity()\n q.query = \"opportunities.date_entered > '2014-09-01'\"\n links = {'Contacts': ['id', 'first_name', 'last_name']}\n results = session.get_entry_list(q, links=links)\n for o in results:\n for c in o.contacts:\n print o.id, c.id, c.first_name, c.last_name\n\nlogin(username, password, app=\"Python\", lang=\"en_us\")\n Logs a user into the SugarCRM application.\n\nset_document_revision(document, file)\n Creates a new document revision for a specific document record.\n\n.. code-block:: python\n\n doc = sugarcrm.Document(document_name=\"Test Doc\", revision=1)\n session.set_entry(doc)\n session.set_document_revision(doc, \"/path/to/test.pdf\")\n\n\nset_entry(sugar_object)\n Creates or updates a specific object.\n\n.. code-block:: python\n\n note = sugarcrm.Note()\n note.name = \"Test Note\"\n note.assigned_user_id = \"82f72939-735e-53a2-0944-5418c4edae2a\"\n session.set_entry(note)\n print note.id\n\nset_note_attachment(note, attachment)\n Creates an attachmentand associates it to a specific note object.\n\n.. code-block:: python\n\n with open(\"test1.pdf\") as pdf_file:\n session.set_note_attachment(note1, pdf_file)\n session.set_note_attachment(note2, \"test2.pdf\")\n print note1.filename, note2.filename\n\nset_relationship(parent, child, delete=False)\n Sets the relationships between two records.\n\n.. code-block:: python\n\n doc = sugarcrm.Document(document_name=\"Test Doc\", revision=1)\n session.set_entry(doc)\n session.set_document_revision(doc, \"/path/to/test.pdf\")\n opportunity = session.get_entry(\"Opportunities\", \"5b671886-cfe4-36f5-fa9d-5418a24e4aca\")\n session.set_relationship(opportunity, doc)\n\n\nUnavailable Methods\n-------------------\n\n.. _issue: https://github.com/ryanss/sugarcrm/issues\n\nThe following lesser-used SugarCRM API methods have not been included in this\nlibrary yet. Please open an issue_ if you require any of these methods and I\nwould be more than happy to implement them!\n\nget_document_revision()\n Method not implemented yet.\n\nget_language_definition()\n Method not implemented yet.\n\nget_last_viewed()\n Method not implemented yet.\n\nget_modified_relationships()\n Method not implemented yet.\n\nget_module_fields()\n Method not implemented yet.\n\nget_module_fields_md5()\n Method not implemented yet.\n\nget_module_layout()\n Method not implemented yet.\n\nget_note_attachment()\n Method not implemented yet.\n\nget_quotes_pdf()\n Method not implemented yet.\n\nget_relationships()\n Method not implemented yet.\n\nget_report_entries()\n Method not implemented yet.\n\nget_report_pdf()\n Method not implemented yet.\n\nget_server_info()\n Method not implemented yet.\n\nget_upcoming_activities()\n Method not implemented yet.\n\nget_user_id()\n Method not implemented yet.\n\nget_user_team_id()\n Method not implemented yet.\n\njob_queue_cycle()\n Method not implemented yet.\n\njob_queue_next()\n Method not implemented yet.\n\njob_queue_run()\n Method not implemented yet.\n\nlogout()\n Method not implemented yet.\n\noauth_access()\n Method not implemented yet.\n\nseamless_login()\n Method not implemented yet.\n\nsearch_by_module()\n Method not implemented yet.\n\nset_campaign_merge()\n Method not implemented yet.\n\nset_entries()\n Method not implemented yet.\n\nset_relationships()\n Method not implemented yet.\n\nsnip_import_emails()\n Method not implemented yet.\n\nsnip_update_contacts()\n Method not implemented yet.\n\n\nSugarCRM Objects\n----------------\n\n.. code-block:: python\n\n >>> call = sugarcrm.Call()\n >>> print call.module\n \"Calls\"\n\n >>> campaign = sugarcrm.Campaign()\n >>> print campaign.module\n \"Campaigns\"\n\n >>> contact = sugarcrm.Contact()\n >>> print contact.module\n \"Contacts\"\n\n >>> document = sugarcrm.Document()\n >>> print document.module\n \"Documents\"\n\n >>> email = sugarcrm.Email()\n >>> print email.module\n \"Emails\"\n\n >>> lead = sugarcrm.Lead()\n >>> print lead.module\n \"Leads\"\n\n >>> module = sugarcrm.Module()\n >>> print module.module\n \"Modules\"\n\n >>> note = sugarcrm.Note()\n >>> print note.module\n \"Notes\"\n\n >>> opportunity = sugarcrm.Opportunity()\n >>> print opportunity.module\n \"Opportunities\"\n\n >>> product = sugarcrm.Product()\n >>> print product.module\n \"Products\"\n\n >>> prospect = sugarcrm.Prospect()\n >>> print prospect.module\n \"Prospects\"\n\n >>> prospect_list = sugarcrm.ProspectList()\n >>> print prospect_list.module\n \"ProspectLists\"\n\n >>> quote = sugarcrm.Quote()\n >>> print quote.module\n \"Quotes\"\n\n >>> report = sugarcrm.Report()\n >>> print report.module\n \"Reports\"\n\n >>> user = sugarcrm.User()\n >>> print user.module\n \"Users\"\n\n\nDevelopment Version\n-------------------\n\nThe latest development version can be installed directly from GitHub:\n\n.. code-block:: bash\n\n $ pip install --upgrade https://github.com/ryanss/sugarcrm/tarball/master\n\n\nContributions\n-------------\n\n.. _issues: https://github.com/ryanss/sugarcrm/issues\n.. __: https://github.com/ryanss/sugarcrm/pulls\n\nIssues_ and `Pull Requests`__ are always welcome.\n\n\nLicense\n-------\n\n.. __: https://github.com/ryanss/sugarcrm/raw/master/LICENSE\n\nCode and documentation are available according to the MIT License\n(see LICENSE__).", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ryanss/sugarcrm", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "sugarcrm", "package_url": "https://pypi.org/project/sugarcrm/", "platform": "any", "project_url": "https://pypi.org/project/sugarcrm/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/ryanss/sugarcrm" }, "release_url": "https://pypi.org/project/sugarcrm/0.1.2/", "requires_dist": null, "requires_python": null, "summary": "Python client for SugarCRM API", "version": "0.1.2" }, "last_serial": 1939912, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "8ffea5d00839a055cb1c1740f79a8314", "sha256": "1f38b7d0cc2061f7a6b1db0d74c4936437d442d5bc7038c723462857110ff22d" }, "downloads": -1, "filename": "sugarcrm-0.1.tar.gz", "has_sig": false, "md5_digest": "8ffea5d00839a055cb1c1740f79a8314", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12387, "upload_time": "2014-12-07T00:27:44", "url": "https://files.pythonhosted.org/packages/bc/e4/41f92de868c9e255e6fd8204422a64a498670d9f3b762ab97d33e635550d/sugarcrm-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "01bfbf7863f6be9f9ceb07fbb4a09929", "sha256": "1b01a752af68d2cba16fcebbce1b407a67ee8f3671b96b3d4a495a80af9d813d" }, "downloads": -1, "filename": "sugarcrm-0.1.1.tar.gz", "has_sig": false, "md5_digest": "01bfbf7863f6be9f9ceb07fbb4a09929", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8088, "upload_time": "2015-10-04T20:56:37", "url": "https://files.pythonhosted.org/packages/ff/b4/fdd2836e590d55d595369eb1d48a8e03edfd67e62cc60e245a0a92619642/sugarcrm-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "3721229732330315ca27d3a7540539d2", "sha256": "df9912f54b000757e37795e65b8bfeb01161fc5647b35b3dbfd93e9e0a52a1c8" }, "downloads": -1, "filename": "sugarcrm-0.1.2.tar.gz", "has_sig": false, "md5_digest": "3721229732330315ca27d3a7540539d2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9346, "upload_time": "2016-02-04T16:04:05", "url": "https://files.pythonhosted.org/packages/92/53/20f528f0bf4604c36ff05ba1142acc3d6007fdafc19c9b7c218732702281/sugarcrm-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3721229732330315ca27d3a7540539d2", "sha256": "df9912f54b000757e37795e65b8bfeb01161fc5647b35b3dbfd93e9e0a52a1c8" }, "downloads": -1, "filename": "sugarcrm-0.1.2.tar.gz", "has_sig": false, "md5_digest": "3721229732330315ca27d3a7540539d2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9346, "upload_time": "2016-02-04T16:04:05", "url": "https://files.pythonhosted.org/packages/92/53/20f528f0bf4604c36ff05ba1142acc3d6007fdafc19c9b7c218732702281/sugarcrm-0.1.2.tar.gz" } ] }