Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
searx-engine
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
searx-engine
Commits
d9231d17
Commit
d9231d17
authored
Jul 11, 2016
by
stepshal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix whitespaces
parent
baab6bcb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
11 deletions
+11
-11
basic_engine.py
examples/basic_engine.py
+1
-1
fabfile.py
utils/fabfile.py
+1
-1
fetch_currencies.py
utils/fetch_currencies.py
+9
-9
No files found.
examples/basic_engine.py
View file @
d9231d17
categories
=
[
'general'
]
# optional
categories
=
[
'general'
]
# optional
def
request
(
query
,
params
):
...
...
utils/fabfile.py
View file @
d9231d17
...
...
@@ -89,7 +89,7 @@ def init():
sudo
(
'git clone https://github.com/asciimoo/searx'
)
sudo
(
'chown -R {user}:{user} {searx_dir}'
.
format
(
user
=
current_user
,
searx_dir
=
searx_dir
))
put
(
StringIO
(
uwsgi_file
),
searx_dir
+
'/uwsgi.ini'
)
put
(
StringIO
(
uwsgi_file
),
searx_dir
+
'/uwsgi.ini'
)
sudo
(
'ln -s {0}/uwsgi.ini /etc/uwsgi/apps-enabled/searx.ini'
.
format
(
searx_dir
))
run
(
'virtualenv {0}'
.
format
(
searx_ve_dir
))
...
...
utils/fetch_currencies.py
View file @
d9231d17
...
...
@@ -10,17 +10,17 @@ languages = {'de', 'en', 'es', 'fr', 'hu', 'it', 'nl', 'jp'}
url_template
=
'https://www.wikidata.org/w/api.php?action=wbgetentities&format=json&{query}&props=labels
%7
Cdatatype
%7
Cclaims
%7
Caliases&languages='
+
'|'
.
join
(
languages
)
url_wmflabs_template
=
'http://wdq.wmflabs.org/api?q='
url_wikidata_search_template
=
'http://www.wikidata.org/w/api.php?action=query&list=search&format=json&srnamespace=0&srprop=sectiontitle&{query}'
url_wikidata_search_template
=
'http://www.wikidata.org/w/api.php?action=query&list=search&format=json&srnamespace=0&srprop=sectiontitle&{query}'
wmflabs_queries
=
[
'CLAIM[31:8142]'
,
# all devise
'CLAIM[31:8142]'
,
# all devise
]
db
=
{
'iso4217'
:
{
},
'names'
:
{
}
'iso4217'
:
{
},
'names'
:
{
}
}
...
...
@@ -29,7 +29,7 @@ def remove_accents(data):
def
normalize_name
(
name
):
return
re
.
sub
(
' +'
,
' '
,
remove_accents
(
name
.
lower
())
.
replace
(
'-'
,
' '
))
return
re
.
sub
(
' +'
,
' '
,
remove_accents
(
name
.
lower
())
.
replace
(
'-'
,
' '
))
def
add_currency_name
(
name
,
iso4217
):
...
...
@@ -51,7 +51,7 @@ def add_currency_name(name, iso4217):
if
iso4217_set
is
not
None
and
iso4217
not
in
iso4217_set
:
db_names
[
name
]
.
append
(
iso4217
)
else
:
db_names
[
name
]
=
[
iso4217
]
db_names
[
name
]
=
[
iso4217
]
def
add_currency_label
(
label
,
iso4217
,
language
):
...
...
@@ -96,7 +96,7 @@ def parse_currency(data):
def
fetch_data
(
wikidata_ids
):
url
=
url_template
.
format
(
query
=
urlencode
({
'ids'
:
'|'
.
join
(
wikidata_ids
)}))
url
=
url_template
.
format
(
query
=
urlencode
({
'ids'
:
'|'
.
join
(
wikidata_ids
)}))
htmlresponse
=
get
(
url
)
jsonresponse
=
json
.
loads
(
htmlresponse
.
content
)
entities
=
jsonresponse
.
get
(
'entities'
,
{})
...
...
Write
Preview
Markdown
is supported
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