converted pull scripts to configuration.py
This commit is contained in:
parent
67d97af546
commit
6f560785d2
6 changed files with 61 additions and 49 deletions
19
ombi.py
19
ombi.py
|
@ -1,26 +1,24 @@
|
|||
# Do not edit this script. Edit configuration.py
|
||||
import requests
|
||||
from datetime import datetime, timezone
|
||||
from influxdb import InfluxDBClient
|
||||
|
||||
# noinspection PyUnresolvedReferences
|
||||
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
||||
# noinspection PyUnresolvedReferences
|
||||
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
||||
import configuration
|
||||
|
||||
current_time = datetime.now(timezone.utc).astimezone().isoformat()
|
||||
|
||||
headers = {'Apikey': 'xxxxxxxxxxxxxxxxxxxxxxx'}
|
||||
get_tv_requests = requests.get('https://request.domain.tld/api/v1/Request/tv', headers=headers).json()
|
||||
get_movie_requests = requests.get('https://request.domain.tld/api/v1/Request/movie', headers=headers).json()
|
||||
headers = {'Apikey': configuration.ombi_api_key}
|
||||
get_tv_requests = requests.get('{}/api/v1/Request/tv'.format(configuration.ombi_url), headers=headers).json()
|
||||
get_movie_requests = requests.get('{}/api/v1/Request/movie'.format(configuration.ombi_url), headers=headers).json()
|
||||
|
||||
count_movie_requests = 0
|
||||
count_tv_requests = 0
|
||||
|
||||
for show in get_tv_requests:
|
||||
count_tv_requests +=1
|
||||
count_tv_requests += 1
|
||||
|
||||
for movie in get_movie_requests:
|
||||
count_movie_requests +=1
|
||||
count_movie_requests += 1
|
||||
|
||||
influx_payload = [
|
||||
{
|
||||
|
@ -35,6 +33,7 @@ influx_payload = [
|
|||
}
|
||||
]
|
||||
|
||||
influx = InfluxDBClient('grafana.domain.tld', 8086, 'root', 'root', 'plex')
|
||||
influx = InfluxDBClient(configuration.grafana_url, configuration.grafana_port, configuration.grafana_username,
|
||||
configuration.grafana_password, configuration.ombi_grafana_db_name)
|
||||
influx.write_points(influx_payload)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue