Skip to content

narhen/python-api-search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python-api-search

How to run

Run API server

$ pip install virtualenv
$ virtualenv apisrc
$ source apisrc/bin/activate
$ pip install -r requirements.txt
$ ARTICLE_API_URL=http://0:30002 gunicorn --chdir api-search/ --reload -b :1234 main:app

In another terminal

$ curl 0:1234

Examples

GET /?query=norge&page-size=2

[
  {
    "type": "articles",
    "results": [
      {
        "introduction": "Innovasjon Norge har ansvar for gjennomføringen...",
        "id": "14074",
        "title": "Innovasjon Norge"
      },
      {
        "introduction": "Trykk på lenkene under her for å lese om ...",
        "id": "15617",
        "title": "Filmutdanning i Norge"
      }
    ]
  },
  {
    "type": "learningpaths",
    "results": [
      {
        "introduction": "<p>Etter at du har fullført denne læringsstien, ...",
        "id": 56,
        "title": "Samfunnsforhold og statsutvikling, 700-1500"
      },
      {
        "introduction": "<p>Når du har gjennomført ...",
        "id": 2,
        "title": "Historia og fortellingene om Norge"
      }
    ]
  }
]