Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
e
infra
spot
Commits
87f1ddee
Commit
87f1ddee
authored
Feb 14, 2019
by
Nicolas Gelot
Browse files
Fix random JSONDecodeError on duckduckgo autocompleter
parent
471ec05f
Changes
1
Hide whitespace changes
Inline
Side-by-side
searx/autocomplete.py
View file @
87f1ddee
...
...
@@ -130,9 +130,10 @@ def duckduckgo(query, lang):
# duckduckgo autocompleter
url
=
'https://ac.duckduckgo.com/ac/?{0}&type=list'
resp
=
loads
(
get
(
url
.
format
(
urlencode
(
dict
(
q
=
query
)))).
text
)
if
len
(
resp
)
>
1
:
return
resp
[
1
]
resp
=
get
(
url
.
format
(
urlencode
(
dict
(
q
=
query
))))
if
resp
.
status_code
==
200
and
resp
.
text
:
res
=
loads
(
resp
.
text
)
return
res
[
1
]
if
len
(
res
)
==
2
else
[]
return
[]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment