We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[APP SUBMITTED]: TypeError: level must be an integer
### INFO
**Python Version**: `2.7.9 (default, Sep 17 2016, 20:26:04) [GCC 4.9.2]`
**Operating System**: `Linux-4.4.38-v7+-armv7l-with-debian-8.0`
**Locale**: `UTF-8`
**Branch**: [develop](../tree/develop)
**Database**: `44.8`
**Commit**: pymedusa/Medusa@289e34a0ff1556d94f314ee1d268036bccbc19ba
**Link to Log**: https://gist.github.com/fab36c448ceab560ac5437227d5f393a
### ERROR
<pre>
2017-05-10 00:06:46 ERROR    SEARCHQUEUE-MANUAL-274431 :: [Danishbits] :: [289e34a] Failed parsing provider. Traceback: 'Traceback (most recent call last):\n  File "/home/pi/Medusa/medusa/providers/torrent/html/danishbits.py", line 174, in parse\n    title, seeders, leechers)\n  File "/home/pi/Medusa/medusa/logger/adapters/style.py", line 79, in log\n    self.logger.log(level, brace_msg, **kwargs)\n  File "/usr/lib/python2.7/logging/__init__.py", line 1482, in log\n    self.logger.log(level, msg, *args, **kwargs)\n  File "/usr/lib/python2.7/logging/__init__.py", line 1220, in log\n    raise TypeError("level must be an integer")\nTypeError: level must be an integer\n'
Traceback (most recent call last):
  File "/home/pi/Medusa/<a href="../blob/289e34a0ff1556d94f314ee1d268036bccbc19ba/medusa/providers/torrent/html/danishbits.py#L174">medusa/providers/torrent/html/danishbits.py</a>", line 174, in parse
    title, seeders, leechers)
  File "/home/pi/Medusa/<a href="../blob/289e34a0ff1556d94f314ee1d268036bccbc19ba/medusa/logger/adapters/style.py#L79">medusa/logger/adapters/style.py</a>", line 79, in log
    self.logger.log(level, brace_msg, **kwargs)
  File "/usr/lib/python2.7/logging/__init__.py", line 1482, in log
    self.logger.log(level, msg, *args, **kwargs)
  File "/usr/lib/python2.7/logging/__init__.py", line 1220, in log
    raise TypeError("level must be an integer")
TypeError: level must be an integer
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `medusa/providers/torrent/html/danishbits.py`
Content:
```
1 # coding=utf-8
2 
3 """Provider code for Danishbits."""
4 
5 from __future__ import unicode_literals
6 
7 import logging
8 import traceback
9 
10 from dateutil import parser
11 
12 from medusa import tv
13 from medusa.bs4_parser import BS4Parser
14 from medusa.helper.common import (
15     convert_size,
16     try_int,
17 )
18 from medusa.logger.adapters.style import BraceAdapter
19 from medusa.providers.torrent.torrent_provider import TorrentProvider
20 
21 from requests.compat import urljoin
22 from requests.utils import dict_from_cookiejar
23 
24 log = BraceAdapter(logging.getLogger(__name__))
25 log.logger.addHandler(logging.NullHandler())
26 
27 
28 class DanishbitsProvider(TorrentProvider):
29     """Danishbits Torrent provider."""
30 
31     def __init__(self):
32         """Initialize the class."""
33         super(self.__class__, self).__init__('Danishbits')
34 
35         # Credentials
36         self.username = None
37         self.password = None
38 
39         # URLs
40         self.url = 'https://danishbits.org'
41         self.urls = {
42             'login': urljoin(self.url, 'login.php'),
43             'search': urljoin(self.url, 'torrents.php'),
44         }
45 
46         # Proper Strings
47 
48         # Miscellaneous Options
49         self.freeleech = True
50 
51         # Torrent Stats
52         self.minseed = 0
53         self.minleech = 0
54 
55         # Cache
56         self.cache = tv.Cache(self, min_time=10)  # Only poll Danishbits every 10 minutes max
57 
58     def search(self, search_strings, age=0, ep_obj=None):
59         """
60         Search a provider and parse the results.
61 
62         :param search_strings: A dict with mode (key) and the search value (value)
63         :param age: Not used
64         :param ep_obj: Not used
65         :returns: A list of search results (structure)
66         """
67         results = []
68         if not self.login():
69             return results
70 
71         # Search Params
72         search_params = {
73             'action': 'newbrowse',
74             'group': 3,
75             'search': '',
76         }
77 
78         for mode in search_strings:
79             log.debug('Search mode: {0}', mode)
80 
81             for search_string in search_strings[mode]:
82 
83                 if mode != 'RSS':
84                     log.debug('Search string: {search}',
85                               {'search': search_string})
86 
87                 search_params['search'] = search_string
88                 response = self.get_url(self.urls['search'], params=search_params, returns='response')
89                 if not response or not response.text:
90                     log.debug('No data returned from provider')
91                     continue
92 
93                 results += self.parse(response.text, mode)
94 
95         return results
96 
97     def parse(self, data, mode):
98         """
99         Parse search results for items.
100 
101         :param data: The raw response from a search
102         :param mode: The current mode used to search, e.g. RSS
103 
104         :return: A list of items found
105         """
106         # Units
107         units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']
108 
109         def process_column_header(td):
110             result = ''
111             if td.img:
112                 result = td.img.get('title')
113             if not result:
114                 result = td.get_text(strip=True)
115             return result
116 
117         items = []
118 
119         with BS4Parser(data, 'html5lib') as html:
120             torrent_table = html.find('table', id='torrent_table')
121             torrent_rows = torrent_table('tr') if torrent_table else []
122 
123             # Continue only if at least one release is found
124             if len(torrent_rows) < 2:
125                 log.debug('Data returned from provider does not contain any torrents')
126                 return items
127 
128             # Literal:     Navn, Størrelse, Kommentarer, Tilføjet, Snatches, Seeders, Leechers
129             # Translation: Name, Size,      Comments,    Added,    Snatches, Seeders, Leechers
130             labels = [process_column_header(label) for label in torrent_rows[0]('td')]
131 
132             # Skip column headers
133             for row in torrent_rows[1:]:
134                 cells = row('td')
135                 if len(cells) < len(labels):
136                     continue
137 
138                 try:
139                     title = row.find(class_='croptorrenttext').get_text(strip=True)
140                     download_url = urljoin(self.url, row.find(title='Direkte download link')['href'])
141                     if not all([title, download_url]):
142                         continue
143 
144                     seeders = try_int(cells[labels.index('Seeders')].get_text(strip=True))
145                     leechers = try_int(cells[labels.index('Leechers')].get_text(strip=True))
146 
147                     # Filter unseeded torrent
148                     if seeders < min(self.minseed, 1):
149                         if mode != 'RSS':
150                             log.debug("Discarding torrent because it doesn't meet the"
151                                       " minimum seeders: {0}. Seeders: {1}",
152                                       title, seeders)
153                         continue
154 
155                     freeleech = row.find(class_='freeleech')
156                     if self.freeleech and not freeleech:
157                         continue
158 
159                     torrent_size = cells[labels.index('Størrelse')].contents[0]
160                     size = convert_size(torrent_size, units=units) or -1
161                     pubdate_raw = cells[labels.index('Tilføjet')].find('span')['title']
162                     pubdate = parser.parse(pubdate_raw, fuzzy=True) if pubdate_raw else None
163 
164                     item = {
165                         'title': title,
166                         'link': download_url,
167                         'size': size,
168                         'seeders': seeders,
169                         'leechers': leechers,
170                         'pubdate': pubdate,
171                     }
172                     if mode != 'RSS':
173                         log.log('Found result: {0} with {1} seeders and {2} leechers',
174                                 title, seeders, leechers)
175 
176                     items.append(item)
177                 except (AttributeError, TypeError, KeyError, ValueError, IndexError):
178                     log.error('Failed parsing provider. Traceback: {0!r}',
179                               traceback.format_exc())
180 
181         return items
182 
183     def login(self):
184         """Login method used for logging in before doing search and torrent downloads."""
185         if any(dict_from_cookiejar(self.session.cookies).values()):
186             return True
187 
188         login_params = {
189             'username': self.username,
190             'password': self.password,
191             'keeplogged': 1,
192             'langlang': '',
193             'login': 'Login',
194         }
195 
196         response = self.get_url(self.urls['login'], post_data=login_params, returns='response')
197         if not response or not response.text:
198             log.warning('Unable to connect to provider')
199             self.session.cookies.clear()
200             return False
201 
202         if '<title>Login :: Danishbits.org</title>' in response.text:
203             log.warning('Invalid username or password. Check your settings')
204             self.session.cookies.clear()
205             return False
206 
207         return True
208 
209 
210 provider = DanishbitsProvider()
211
```
--- 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()

```

diff --git a/medusa/providers/torrent/html/danishbits.py b/medusa/providers/torrent/html/danishbits.py
--- a/medusa/providers/torrent/html/danishbits.py
+++ b/medusa/providers/torrent/html/danishbits.py
@@ -170,8 +170,8 @@
                         'pubdate': pubdate,
                     }
                     if mode != 'RSS':
-                        log.log('Found result: {0} with {1} seeders and {2} leechers',
-                                title, seeders, leechers)
+                        log.debug('Found result: {0} with {1} seeders and {2} leechers',
+                                  title, seeders, leechers)
 
                     items.append(item)
                 except (AttributeError, TypeError, KeyError, ValueError, IndexError):

{"golden_diff": "diff --git a/medusa/providers/torrent/html/danishbits.py b/medusa/providers/torrent/html/danishbits.py\n--- a/medusa/providers/torrent/html/danishbits.py\n+++ b/medusa/providers/torrent/html/danishbits.py\n@@ -170,8 +170,8 @@\n                         'pubdate': pubdate,\n                     }\n                     if mode != 'RSS':\n-                        log.log('Found result: {0} with {1} seeders and {2} leechers',\n-                                title, seeders, leechers)\n+                        log.debug('Found result: {0} with {1} seeders and {2} leechers',\n+                                  title, seeders, leechers)\n \n                     items.append(item)\n                 except (AttributeError, TypeError, KeyError, ValueError, IndexError):\n", "issue": "[APP SUBMITTED]: TypeError: level must be an integer\n### INFO\n**Python Version**: `2.7.9 (default, Sep 17 2016, 20:26:04) [GCC 4.9.2]`\n**Operating System**: `Linux-4.4.38-v7+-armv7l-with-debian-8.0`\n**Locale**: `UTF-8`\n**Branch**: [develop](../tree/develop)\n**Database**: `44.8`\n**Commit**: pymedusa/Medusa@289e34a0ff1556d94f314ee1d268036bccbc19ba\n**Link to Log**: https://gist.github.com/fab36c448ceab560ac5437227d5f393a\n### ERROR\n<pre>\n2017-05-10 00:06:46 ERROR    SEARCHQUEUE-MANUAL-274431 :: [Danishbits] :: [289e34a] Failed parsing provider. Traceback: 'Traceback (most recent call last):\\n  File \"/home/pi/Medusa/medusa/providers/torrent/html/danishbits.py\", line 174, in parse\\n    title, seeders, leechers)\\n  File \"/home/pi/Medusa/medusa/logger/adapters/style.py\", line 79, in log\\n    self.logger.log(level, brace_msg, **kwargs)\\n  File \"/usr/lib/python2.7/logging/__init__.py\", line 1482, in log\\n    self.logger.log(level, msg, *args, **kwargs)\\n  File \"/usr/lib/python2.7/logging/__init__.py\", line 1220, in log\\n    raise TypeError(\"level must be an integer\")\\nTypeError: level must be an integer\\n'\nTraceback (most recent call last):\n  File \"/home/pi/Medusa/<a href=\"../blob/289e34a0ff1556d94f314ee1d268036bccbc19ba/medusa/providers/torrent/html/danishbits.py#L174\">medusa/providers/torrent/html/danishbits.py</a>\", line 174, in parse\n    title, seeders, leechers)\n  File \"/home/pi/Medusa/<a href=\"../blob/289e34a0ff1556d94f314ee1d268036bccbc19ba/medusa/logger/adapters/style.py#L79\">medusa/logger/adapters/style.py</a>\", line 79, in log\n    self.logger.log(level, brace_msg, **kwargs)\n  File \"/usr/lib/python2.7/logging/__init__.py\", line 1482, in log\n    self.logger.log(level, msg, *args, **kwargs)\n  File \"/usr/lib/python2.7/logging/__init__.py\", line 1220, in log\n    raise TypeError(\"level must be an integer\")\nTypeError: level must be an integer\n</pre>\n---\n_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators\n", "before_files": [{"content": "# coding=utf-8\n\n\"\"\"Provider code for Danishbits.\"\"\"\n\nfrom __future__ import unicode_literals\n\nimport logging\nimport traceback\n\nfrom dateutil import parser\n\nfrom medusa import tv\nfrom medusa.bs4_parser import BS4Parser\nfrom medusa.helper.common import (\n    convert_size,\n    try_int,\n)\nfrom medusa.logger.adapters.style import BraceAdapter\nfrom medusa.providers.torrent.torrent_provider import TorrentProvider\n\nfrom requests.compat import urljoin\nfrom requests.utils import dict_from_cookiejar\n\nlog = BraceAdapter(logging.getLogger(__name__))\nlog.logger.addHandler(logging.NullHandler())\n\n\nclass DanishbitsProvider(TorrentProvider):\n    \"\"\"Danishbits Torrent provider.\"\"\"\n\n    def __init__(self):\n        \"\"\"Initialize the class.\"\"\"\n        super(self.__class__, self).__init__('Danishbits')\n\n        # Credentials\n        self.username = None\n        self.password = None\n\n        # URLs\n        self.url = 'https://danishbits.org'\n        self.urls = {\n            'login': urljoin(self.url, 'login.php'),\n            'search': urljoin(self.url, 'torrents.php'),\n        }\n\n        # Proper Strings\n\n        # Miscellaneous Options\n        self.freeleech = True\n\n        # Torrent Stats\n        self.minseed = 0\n        self.minleech = 0\n\n        # Cache\n        self.cache = tv.Cache(self, min_time=10)  # Only poll Danishbits every 10 minutes max\n\n    def search(self, search_strings, age=0, ep_obj=None):\n        \"\"\"\n        Search a provider and parse the results.\n\n        :param search_strings: A dict with mode (key) and the search value (value)\n        :param age: Not used\n        :param ep_obj: Not used\n        :returns: A list of search results (structure)\n        \"\"\"\n        results = []\n        if not self.login():\n            return results\n\n        # Search Params\n        search_params = {\n            'action': 'newbrowse',\n            'group': 3,\n            'search': '',\n        }\n\n        for mode in search_strings:\n            log.debug('Search mode: {0}', mode)\n\n            for search_string in search_strings[mode]:\n\n                if mode != 'RSS':\n                    log.debug('Search string: {search}',\n                              {'search': search_string})\n\n                search_params['search'] = search_string\n                response = self.get_url(self.urls['search'], params=search_params, returns='response')\n                if not response or not response.text:\n                    log.debug('No data returned from provider')\n                    continue\n\n                results += self.parse(response.text, mode)\n\n        return results\n\n    def parse(self, data, mode):\n        \"\"\"\n        Parse search results for items.\n\n        :param data: The raw response from a search\n        :param mode: The current mode used to search, e.g. RSS\n\n        :return: A list of items found\n        \"\"\"\n        # Units\n        units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']\n\n        def process_column_header(td):\n            result = ''\n            if td.img:\n                result = td.img.get('title')\n            if not result:\n                result = td.get_text(strip=True)\n            return result\n\n        items = []\n\n        with BS4Parser(data, 'html5lib') as html:\n            torrent_table = html.find('table', id='torrent_table')\n            torrent_rows = torrent_table('tr') if torrent_table else []\n\n            # Continue only if at least one release is found\n            if len(torrent_rows) < 2:\n                log.debug('Data returned from provider does not contain any torrents')\n                return items\n\n            # Literal:     Navn, St\u00f8rrelse, Kommentarer, Tilf\u00f8jet, Snatches, Seeders, Leechers\n            # Translation: Name, Size,      Comments,    Added,    Snatches, Seeders, Leechers\n            labels = [process_column_header(label) for label in torrent_rows[0]('td')]\n\n            # Skip column headers\n            for row in torrent_rows[1:]:\n                cells = row('td')\n                if len(cells) < len(labels):\n                    continue\n\n                try:\n                    title = row.find(class_='croptorrenttext').get_text(strip=True)\n                    download_url = urljoin(self.url, row.find(title='Direkte download link')['href'])\n                    if not all([title, download_url]):\n                        continue\n\n                    seeders = try_int(cells[labels.index('Seeders')].get_text(strip=True))\n                    leechers = try_int(cells[labels.index('Leechers')].get_text(strip=True))\n\n                    # Filter unseeded torrent\n                    if seeders < min(self.minseed, 1):\n                        if mode != 'RSS':\n                            log.debug(\"Discarding torrent because it doesn't meet the\"\n                                      \" minimum seeders: {0}. Seeders: {1}\",\n                                      title, seeders)\n                        continue\n\n                    freeleech = row.find(class_='freeleech')\n                    if self.freeleech and not freeleech:\n                        continue\n\n                    torrent_size = cells[labels.index('St\u00f8rrelse')].contents[0]\n                    size = convert_size(torrent_size, units=units) or -1\n                    pubdate_raw = cells[labels.index('Tilf\u00f8jet')].find('span')['title']\n                    pubdate = parser.parse(pubdate_raw, fuzzy=True) if pubdate_raw else None\n\n                    item = {\n                        'title': title,\n                        'link': download_url,\n                        'size': size,\n                        'seeders': seeders,\n                        'leechers': leechers,\n                        'pubdate': pubdate,\n                    }\n                    if mode != 'RSS':\n                        log.log('Found result: {0} with {1} seeders and {2} leechers',\n                                title, seeders, leechers)\n\n                    items.append(item)\n                except (AttributeError, TypeError, KeyError, ValueError, IndexError):\n                    log.error('Failed parsing provider. Traceback: {0!r}',\n                              traceback.format_exc())\n\n        return items\n\n    def login(self):\n        \"\"\"Login method used for logging in before doing search and torrent downloads.\"\"\"\n        if any(dict_from_cookiejar(self.session.cookies).values()):\n            return True\n\n        login_params = {\n            'username': self.username,\n            'password': self.password,\n            'keeplogged': 1,\n            'langlang': '',\n            'login': 'Login',\n        }\n\n        response = self.get_url(self.urls['login'], post_data=login_params, returns='response')\n        if not response or not response.text:\n            log.warning('Unable to connect to provider')\n            self.session.cookies.clear()\n            return False\n\n        if '<title>Login :: Danishbits.org</title>' in response.text:\n            log.warning('Invalid username or password. Check your settings')\n            self.session.cookies.clear()\n            return False\n\n        return True\n\n\nprovider = DanishbitsProvider()\n", "path": "medusa/providers/torrent/html/danishbits.py"}], "after_files": [{"content": "# coding=utf-8\n\n\"\"\"Provider code for Danishbits.\"\"\"\n\nfrom __future__ import unicode_literals\n\nimport logging\nimport traceback\n\nfrom dateutil import parser\n\nfrom medusa import tv\nfrom medusa.bs4_parser import BS4Parser\nfrom medusa.helper.common import (\n    convert_size,\n    try_int,\n)\nfrom medusa.logger.adapters.style import BraceAdapter\nfrom medusa.providers.torrent.torrent_provider import TorrentProvider\n\nfrom requests.compat import urljoin\nfrom requests.utils import dict_from_cookiejar\n\nlog = BraceAdapter(logging.getLogger(__name__))\nlog.logger.addHandler(logging.NullHandler())\n\n\nclass DanishbitsProvider(TorrentProvider):\n    \"\"\"Danishbits Torrent provider.\"\"\"\n\n    def __init__(self):\n        \"\"\"Initialize the class.\"\"\"\n        super(self.__class__, self).__init__('Danishbits')\n\n        # Credentials\n        self.username = None\n        self.password = None\n\n        # URLs\n        self.url = 'https://danishbits.org'\n        self.urls = {\n            'login': urljoin(self.url, 'login.php'),\n            'search': urljoin(self.url, 'torrents.php'),\n        }\n\n        # Proper Strings\n\n        # Miscellaneous Options\n        self.freeleech = True\n\n        # Torrent Stats\n        self.minseed = 0\n        self.minleech = 0\n\n        # Cache\n        self.cache = tv.Cache(self, min_time=10)  # Only poll Danishbits every 10 minutes max\n\n    def search(self, search_strings, age=0, ep_obj=None):\n        \"\"\"\n        Search a provider and parse the results.\n\n        :param search_strings: A dict with mode (key) and the search value (value)\n        :param age: Not used\n        :param ep_obj: Not used\n        :returns: A list of search results (structure)\n        \"\"\"\n        results = []\n        if not self.login():\n            return results\n\n        # Search Params\n        search_params = {\n            'action': 'newbrowse',\n            'group': 3,\n            'search': '',\n        }\n\n        for mode in search_strings:\n            log.debug('Search mode: {0}', mode)\n\n            for search_string in search_strings[mode]:\n\n                if mode != 'RSS':\n                    log.debug('Search string: {search}',\n                              {'search': search_string})\n\n                search_params['search'] = search_string\n                response = self.get_url(self.urls['search'], params=search_params, returns='response')\n                if not response or not response.text:\n                    log.debug('No data returned from provider')\n                    continue\n\n                results += self.parse(response.text, mode)\n\n        return results\n\n    def parse(self, data, mode):\n        \"\"\"\n        Parse search results for items.\n\n        :param data: The raw response from a search\n        :param mode: The current mode used to search, e.g. RSS\n\n        :return: A list of items found\n        \"\"\"\n        # Units\n        units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']\n\n        def process_column_header(td):\n            result = ''\n            if td.img:\n                result = td.img.get('title')\n            if not result:\n                result = td.get_text(strip=True)\n            return result\n\n        items = []\n\n        with BS4Parser(data, 'html5lib') as html:\n            torrent_table = html.find('table', id='torrent_table')\n            torrent_rows = torrent_table('tr') if torrent_table else []\n\n            # Continue only if at least one release is found\n            if len(torrent_rows) < 2:\n                log.debug('Data returned from provider does not contain any torrents')\n                return items\n\n            # Literal:     Navn, St\u00f8rrelse, Kommentarer, Tilf\u00f8jet, Snatches, Seeders, Leechers\n            # Translation: Name, Size,      Comments,    Added,    Snatches, Seeders, Leechers\n            labels = [process_column_header(label) for label in torrent_rows[0]('td')]\n\n            # Skip column headers\n            for row in torrent_rows[1:]:\n                cells = row('td')\n                if len(cells) < len(labels):\n                    continue\n\n                try:\n                    title = row.find(class_='croptorrenttext').get_text(strip=True)\n                    download_url = urljoin(self.url, row.find(title='Direkte download link')['href'])\n                    if not all([title, download_url]):\n                        continue\n\n                    seeders = try_int(cells[labels.index('Seeders')].get_text(strip=True))\n                    leechers = try_int(cells[labels.index('Leechers')].get_text(strip=True))\n\n                    # Filter unseeded torrent\n                    if seeders < min(self.minseed, 1):\n                        if mode != 'RSS':\n                            log.debug(\"Discarding torrent because it doesn't meet the\"\n                                      \" minimum seeders: {0}. Seeders: {1}\",\n                                      title, seeders)\n                        continue\n\n                    freeleech = row.find(class_='freeleech')\n                    if self.freeleech and not freeleech:\n                        continue\n\n                    torrent_size = cells[labels.index('St\u00f8rrelse')].contents[0]\n                    size = convert_size(torrent_size, units=units) or -1\n                    pubdate_raw = cells[labels.index('Tilf\u00f8jet')].find('span')['title']\n                    pubdate = parser.parse(pubdate_raw, fuzzy=True) if pubdate_raw else None\n\n                    item = {\n                        'title': title,\n                        'link': download_url,\n                        'size': size,\n                        'seeders': seeders,\n                        'leechers': leechers,\n                        'pubdate': pubdate,\n                    }\n                    if mode != 'RSS':\n                        log.debug('Found result: {0} with {1} seeders and {2} leechers',\n                                  title, seeders, leechers)\n\n                    items.append(item)\n                except (AttributeError, TypeError, KeyError, ValueError, IndexError):\n                    log.error('Failed parsing provider. Traceback: {0!r}',\n                              traceback.format_exc())\n\n        return items\n\n    def login(self):\n        \"\"\"Login method used for logging in before doing search and torrent downloads.\"\"\"\n        if any(dict_from_cookiejar(self.session.cookies).values()):\n            return True\n\n        login_params = {\n            'username': self.username,\n            'password': self.password,\n            'keeplogged': 1,\n            'langlang': '',\n            'login': 'Login',\n        }\n\n        response = self.get_url(self.urls['login'], post_data=login_params, returns='response')\n        if not response or not response.text:\n            log.warning('Unable to connect to provider')\n            self.session.cookies.clear()\n            return False\n\n        if '<title>Login :: Danishbits.org</title>' in response.text:\n            log.warning('Invalid username or password. Check your settings')\n            self.session.cookies.clear()\n            return False\n\n        return True\n\n\nprovider = DanishbitsProvider()\n", "path": "medusa/providers/torrent/html/danishbits.py"}]}