Commit a9f9218f authored by c24b's avatar c24b

New method to get ressource info given a ressource type id

parent 616258ec
...@@ -128,26 +128,10 @@ from gargantext.util.parsers import \ ...@@ -128,26 +128,10 @@ from gargantext.util.parsers import \
from gargantext.util.scrappers import \ from gargantext.util.scrappers import \
CernScraper CernScraper
def resourcetype(corpus_name):
''' def get_resource(corpus_type):
resourcetype Name :: Int '''get ressources values for a given ressource_type id'''
Usage : resourcetype("Europress (English)") == 1 return [n for n in RESOURCES_TYPE if n["type"] == corpus_type][0]
Examples in scrapers scripts (Pubmed or ISTex for instance).
'''
return [n["type"] for n in RESOURCETYPES if n["name"]== corpus_name][0]
def resourcename(corpus_type):
'''
resourcetype :: Corpus_type -> String
Usage : resourcename(corpus.type) == "ISTex"
'''
resource = corpus.resources()[0]
resourcename = RESOURCETYPES[resource['type']]['name']
return [n["name"] for n in RESOURCETYPES if n["type"]== corpus_type][0]
def get_resource(corpus):
print(corpus.items())
return
RESOURCETYPES = [ RESOURCETYPES = [
# type 0 # type 0
...@@ -226,6 +210,7 @@ RESOURCETYPES = [ ...@@ -226,6 +210,7 @@ RESOURCETYPES = [
"default_language": "en", "default_language": "en",
'accepted_formats':["zip","xml"], 'accepted_formats':["zip","xml"],
"scrapper": CernScrapper, "scrapper": CernScrapper,
"base_url": "http://api.scoap3.org/search?",
}, },
] ]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment