Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- from basicauth import encode
- from pprint import pprint
- import json
- class JenkinsInfo(object):
- defaultHeader = {
- 'Accept': 'application/json, */*',
- 'content-type': 'application/json',
- 'Authorization': ''
- }
- def __init__(self, url, user, password):
- self.jenkins_url = url.rstrip("/")
- self.jenkins_user = user
- self.jenkins_password = password
- self.s = requests.Session()
- self.ssl_verify = ssl_verify
- self.defaultHeader['Authorization'] = encode(user, password)
- #### the script below is the one that call previous class ###
- from prometheus_client import start_http_server,Counter
- from conf_example import JENKINS_URL, JENKINS_USER,
- JENKINS_PASSWORD
- from jenkins_metrics import JenkinsInfo
- import time
- from sys import exit
- def main():
- print("Starting Jenkins Metrics")
- jenkins = JenkinsInfo(JENKINS_URL, JENKINS_USER, JENKINS_PASSWORD)
Add Comment
Please, Sign In to add comment