-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from binary-butterfly/source-cli
source cli
- Loading branch information
Showing
6 changed files
with
81 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,5 +23,4 @@ SERVER_AUTH_USERS: | |
- bnetza | ||
|
||
AUTO_FETCH_SOURCES: | ||
- bnetza | ||
- sw-stuttgart | ||
- sw_stuttgart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,3 +39,6 @@ REMOTE_SERVERS: | |
url: http://localhost:5000 | ||
user: bnetza | ||
password: test | ||
|
||
AUTO_FETCH_SOURCES: | ||
- sw_stuttgart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
""" | ||
Open ChargePoint DataBase OCPDB | ||
Copyright (C) 2021 binary butterfly GmbH | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
""" | ||
|
||
import click | ||
from flask.cli import AppGroup | ||
|
||
from webapp.common.error_handling import catch_exception | ||
from webapp.dependencies import dependencies | ||
from webapp.services.import_services import ImportServices | ||
|
||
source_cli = AppGroup('source', help='Generic interface for fetching all data sources') | ||
|
||
|
||
@source_cli.command('fetch-all', help='Fetches static and realtime data from all auto-fetched sources.') | ||
@catch_exception | ||
def fetch_all_sources() -> None: | ||
import_service: ImportServices = dependencies.get_import_services() | ||
import_service.fetch_sources() | ||
|
||
|
||
@source_cli.command('fetch', help='Fetches static and realtime data for specified source.') | ||
@click.argument('source_uid') | ||
@catch_exception | ||
def fetch_source(source_uid: str) -> None: | ||
import_service: ImportServices = dependencies.get_import_services() | ||
import_service.fetch_source(source_uid) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters