prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  [10.0] mail_sendrid, Error: No module named simplejson
  > File ".../addons/oca-social/mail_sendgrid/controllers/json_request.py", line 4, in <module>
  >     import simplejson
  > ImportError: No module named simplejson
  
  I put `simplejson` into file requirements.txt and it solved this issue.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `mail_sendgrid/controllers/json_request.py`
  Content:
  ```
  1 # -*- coding: utf-8 -*-
  2 # Copyright 2016-2017 Compassion CH (http://www.compassion.ch)
  3 # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4 import simplejson
  5 
  6 from odoo.http import JsonRequest, Root, Response
  7 
  8 # Monkeypatch type of request rooter to use RESTJsonRequest
  9 old_get_request = Root.get_request
  10 
  11 
  12 def get_request(self, httprequest):
  13     if (httprequest.mimetype == "application/json" and
  14             httprequest.environ['PATH_INFO'].startswith('/mail')):
  15         return RESTJsonRequest(httprequest)
  16     return old_get_request(self, httprequest)
  17 
  18 
  19 Root.get_request = get_request
  20 
  21 
  22 class RESTJsonRequest(JsonRequest):
  23     """ Special RestJson Handler to enable receiving lists in JSON
  24         body
  25     """
  26     def __init__(self, *args):
  27         try:
  28             super(RESTJsonRequest, self).__init__(*args)
  29         except AttributeError:
  30             # The JSON may contain a list
  31             self.params = dict()
  32             self.context = dict(self.session.context)
  33 
  34     def _json_response(self, result=None, error=None):
  35         response = {}
  36         if error is not None:
  37             response['error'] = error
  38         if result is not None:
  39             response['result'] = result
  40 
  41         mime = 'application/json'
  42         body = simplejson.dumps(response)
  43 
  44         return Response(
  45             body, headers=[('Content-Type', mime),
  46                            ('Content-Length', len(body))])
  47
  ```
  
  Path: `mail_sendgrid/__manifest__.py`
  Content:
  ```
  1 # -*- coding: utf-8 -*-
  2 # Copyright 2015-2017 Compassion CH (http://www.compassion.ch)
  3 # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4 {
  5     'name': 'SendGrid',
  6     'version': '10.0.1.0.0',
  7     'category': 'Social Network',
  8     'author': 'Compassion CH, Odoo Community Association (OCA)',
  9     'license': 'AGPL-3',
  10     'website': 'https://github.com/OCA/social',
  11     'depends': ['mail_tracking'],
  12     'data': [
  13         'security/ir.model.access.csv',
  14         'views/sendgrid_email_view.xml',
  15         'views/sendgrid_template_view.xml',
  16         'views/mail_compose_message_view.xml',
  17         'views/email_template_view.xml',
  18     ],
  19     'demo': [],
  20     'installable': True,
  21     'auto_install': False,
  22     'external_dependencies': {
  23         'python': ['sendgrid'],
  24     },
  25 }
  26
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/mail_sendgrid/__manifest__.py b/mail_sendgrid/__manifest__.py
  --- a/mail_sendgrid/__manifest__.py
  +++ b/mail_sendgrid/__manifest__.py
  @@ -1,9 +1,9 @@
   # -*- coding: utf-8 -*-
  -# Copyright 2015-2017 Compassion CH (http://www.compassion.ch)
  +# Copyright 2015-2018 Compassion CH (http://www.compassion.ch)
   # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
   {
       'name': 'SendGrid',
  -    'version': '10.0.1.0.0',
  +    'version': '10.0.1.0.1',
       'category': 'Social Network',
       'author': 'Compassion CH, Odoo Community Association (OCA)',
       'license': 'AGPL-3',
  @@ -20,6 +20,6 @@
       'installable': True,
       'auto_install': False,
       'external_dependencies': {
  -        'python': ['sendgrid'],
  +        'python': ['sendgrid', 'simplejson'],
       },
   }
  diff --git a/mail_sendgrid/controllers/json_request.py b/mail_sendgrid/controllers/json_request.py
  --- a/mail_sendgrid/controllers/json_request.py
  +++ b/mail_sendgrid/controllers/json_request.py
  @@ -1,12 +1,18 @@
   # -*- coding: utf-8 -*-
   # Copyright 2016-2017 Compassion CH (http://www.compassion.ch)
   # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  -import simplejson
  -
  +import logging
   from odoo.http import JsonRequest, Root, Response
   
   # Monkeypatch type of request rooter to use RESTJsonRequest
   old_get_request = Root.get_request
  +_logger = logging.getLogger(__name__)
  +
  +try:
  +    import simplejson
  +except ImportError:
  +    _logger.error("Please install simplejson tu use mail_sendgrid module")
  +    _logger.debug("ImportError details:", exc_info=True)
   
   
   def get_request(self, httprequest):
  
verification_info: {"golden_diff": "diff --git a/mail_sendgrid/__manifest__.py b/mail_sendgrid/__manifest__.py\n--- a/mail_sendgrid/__manifest__.py\n+++ b/mail_sendgrid/__manifest__.py\n@@ -1,9 +1,9 @@\n # -*- coding: utf-8 -*-\n-# Copyright 2015-2017 Compassion CH (http://www.compassion.ch)\n+# Copyright 2015-2018 Compassion CH (http://www.compassion.ch)\n # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).\n {\n     'name': 'SendGrid',\n-    'version': '10.0.1.0.0',\n+    'version': '10.0.1.0.1',\n     'category': 'Social Network',\n     'author': 'Compassion CH, Odoo Community Association (OCA)',\n     'license': 'AGPL-3',\n@@ -20,6 +20,6 @@\n     'installable': True,\n     'auto_install': False,\n     'external_dependencies': {\n-        'python': ['sendgrid'],\n+        'python': ['sendgrid', 'simplejson'],\n     },\n }\ndiff --git a/mail_sendgrid/controllers/json_request.py b/mail_sendgrid/controllers/json_request.py\n--- a/mail_sendgrid/controllers/json_request.py\n+++ b/mail_sendgrid/controllers/json_request.py\n@@ -1,12 +1,18 @@\n # -*- coding: utf-8 -*-\n # Copyright 2016-2017 Compassion CH (http://www.compassion.ch)\n # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).\n-import simplejson\n-\n+import logging\n from odoo.http import JsonRequest, Root, Response\n \n # Monkeypatch type of request rooter to use RESTJsonRequest\n old_get_request = Root.get_request\n+_logger = logging.getLogger(__name__)\n+\n+try:\n+    import simplejson\n+except ImportError:\n+    _logger.error(\"Please install simplejson tu use mail_sendgrid module\")\n+    _logger.debug(\"ImportError details:\", exc_info=True)\n \n \n def get_request(self, httprequest):\n", "issue": "[10.0] mail_sendrid, Error: No module named simplejson\n> File \".../addons/oca-social/mail_sendgrid/controllers/json_request.py\", line 4, in <module>\r\n>     import simplejson\r\n> ImportError: No module named simplejson\r\n\r\nI put `simplejson` into file requirements.txt and it solved this issue.\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n# Copyright 2016-2017 Compassion CH (http://www.compassion.ch)\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).\nimport simplejson\n\nfrom odoo.http import JsonRequest, Root, Response\n\n# Monkeypatch type of request rooter to use RESTJsonRequest\nold_get_request = Root.get_request\n\n\ndef get_request(self, httprequest):\n    if (httprequest.mimetype == \"application/json\" and\n            httprequest.environ['PATH_INFO'].startswith('/mail')):\n        return RESTJsonRequest(httprequest)\n    return old_get_request(self, httprequest)\n\n\nRoot.get_request = get_request\n\n\nclass RESTJsonRequest(JsonRequest):\n    \"\"\" Special RestJson Handler to enable receiving lists in JSON\n        body\n    \"\"\"\n    def __init__(self, *args):\n        try:\n            super(RESTJsonRequest, self).__init__(*args)\n        except AttributeError:\n            # The JSON may contain a list\n            self.params = dict()\n            self.context = dict(self.session.context)\n\n    def _json_response(self, result=None, error=None):\n        response = {}\n        if error is not None:\n            response['error'] = error\n        if result is not None:\n            response['result'] = result\n\n        mime = 'application/json'\n        body = simplejson.dumps(response)\n\n        return Response(\n            body, headers=[('Content-Type', mime),\n                           ('Content-Length', len(body))])\n", "path": "mail_sendgrid/controllers/json_request.py"}, {"content": "# -*- coding: utf-8 -*-\n# Copyright 2015-2017 Compassion CH (http://www.compassion.ch)\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).\n{\n    'name': 'SendGrid',\n    'version': '10.0.1.0.0',\n    'category': 'Social Network',\n    'author': 'Compassion CH, Odoo Community Association (OCA)',\n    'license': 'AGPL-3',\n    'website': 'https://github.com/OCA/social',\n    'depends': ['mail_tracking'],\n    'data': [\n        'security/ir.model.access.csv',\n        'views/sendgrid_email_view.xml',\n        'views/sendgrid_template_view.xml',\n        'views/mail_compose_message_view.xml',\n        'views/email_template_view.xml',\n    ],\n    'demo': [],\n    'installable': True,\n    'auto_install': False,\n    'external_dependencies': {\n        'python': ['sendgrid'],\n    },\n}\n", "path": "mail_sendgrid/__manifest__.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n# Copyright 2016-2017 Compassion CH (http://www.compassion.ch)\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).\nimport logging\nfrom odoo.http import JsonRequest, Root, Response\n\n# Monkeypatch type of request rooter to use RESTJsonRequest\nold_get_request = Root.get_request\n_logger = logging.getLogger(__name__)\n\ntry:\n    import simplejson\nexcept ImportError:\n    _logger.error(\"Please install simplejson tu use mail_sendgrid module\")\n    _logger.debug(\"ImportError details:\", exc_info=True)\n\n\ndef get_request(self, httprequest):\n    if (httprequest.mimetype == \"application/json\" and\n            httprequest.environ['PATH_INFO'].startswith('/mail')):\n        return RESTJsonRequest(httprequest)\n    return old_get_request(self, httprequest)\n\n\nRoot.get_request = get_request\n\n\nclass RESTJsonRequest(JsonRequest):\n    \"\"\" Special RestJson Handler to enable receiving lists in JSON\n        body\n    \"\"\"\n    def __init__(self, *args):\n        try:\n            super(RESTJsonRequest, self).__init__(*args)\n        except AttributeError:\n            # The JSON may contain a list\n            self.params = dict()\n            self.context = dict(self.session.context)\n\n    def _json_response(self, result=None, error=None):\n        response = {}\n        if error is not None:\n            response['error'] = error\n        if result is not None:\n            response['result'] = result\n\n        mime = 'application/json'\n        body = simplejson.dumps(response)\n\n        return Response(\n            body, headers=[('Content-Type', mime),\n                           ('Content-Length', len(body))])\n", "path": "mail_sendgrid/controllers/json_request.py"}, {"content": "# -*- coding: utf-8 -*-\n# Copyright 2015-2018 Compassion CH (http://www.compassion.ch)\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).\n{\n    'name': 'SendGrid',\n    'version': '10.0.1.0.1',\n    'category': 'Social Network',\n    'author': 'Compassion CH, Odoo Community Association (OCA)',\n    'license': 'AGPL-3',\n    'website': 'https://github.com/OCA/social',\n    'depends': ['mail_tracking'],\n    'data': [\n        'security/ir.model.access.csv',\n        'views/sendgrid_email_view.xml',\n        'views/sendgrid_template_view.xml',\n        'views/mail_compose_message_view.xml',\n        'views/email_template_view.xml',\n    ],\n    'demo': [],\n    'installable': True,\n    'auto_install': False,\n    'external_dependencies': {\n        'python': ['sendgrid', 'simplejson'],\n    },\n}\n", "path": "mail_sendgrid/__manifest__.py"}]}