Skip to content

Instantly share code, notes, and snippets.

@pavelzag
Created September 5, 2019 19:50
Show Gist options
  • Save pavelzag/bb06074716e1c30f259a9e2cb9b0e43a to your computer and use it in GitHub Desktop.
Save pavelzag/bb06074716e1c30f259a9e2cb9b0e43a to your computer and use it in GitHub Desktop.
@app.route('/trigger_jenkins_job', methods=['POST'])
def trigger_jenkins_job():
content = request.get_json()
city_name = content['city_name']
country_language = get_language(city_name)
country_name = get_country(city_name)
result = server.build_job(name=JENKINS_JOB_NAME, parameters={'CITY_NAME': city_name,
'COUNTRY_NAME': country_name,
'COUNTRY_LANGUAGE': country_language})
if result:
return Response(dumps(SUCCESS_MESSAGE), status=200, mimetype='application/json')
else:
return Response(dumps(FAILURE_MESSAGE), status=400, mimetype='application/json')
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0', use_reloader=True, port=8081)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment