Skip to content

Commit

Permalink
Add "robots.txt" to HTTP API
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Jun 2, 2020
1 parent 34663f1 commit 65d2146
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGES.rst
Expand Up @@ -7,6 +7,11 @@ Development
===========


2020-06-02 0.5.0
================
- Add "robots.txt" to HTTP API


2020-06-02 0.4.0
================
- Improve documentation, naming things
Expand Down
10 changes: 9 additions & 1 deletion apicast/api.py
Expand Up @@ -3,7 +3,7 @@
# License: GNU Affero General Public License, Version 3
import logging
from fastapi import FastAPI, Query
from fastapi.responses import HTMLResponse
from fastapi.responses import HTMLResponse, PlainTextResponse

from apicast import __appname__, __version__
from apicast.core import dwd_beeflight_forecast_stations, dwd_beeflight_forecast_stations_site_slugs, \
Expand Down Expand Up @@ -46,6 +46,14 @@ def index():
"""


@app.get("/robots.txt", response_class=PlainTextResponse)
def robots():
return f"""
User-agent: *
Disallow: /beeflight/
""".strip()


@app.get("/beeflight/germany/stations")
def beeflight_stations():
stations = dwd_beeflight_forecast_stations()
Expand Down

0 comments on commit 65d2146

Please sign in to comment.