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
#!/usr/bin/env python | |
# coding=utf-8 | |
# | |
# Copyright © 2015 VMware, Inc. All Rights Reserved. | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | |
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation | |
# the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and | |
# to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
# |
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
#!/usr/bin/python | |
import requests | |
import json | |
def get_temperature(appkey, city, module, units='metric'): | |
session = requests.Session() | |
headers = {'Content-Type': 'application/json'} | |
url = 'http://api.openweathermap.org/data/2.5/weather' | |
params = {'q': city, 'APPID': appkey, 'units': units} |
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
#!/usr/bin/python | |
import json | |
def main(): | |
module = AnsibleModule( | |
argument_spec=dict( | |
appkey=dict(required=True), | |
city=dict(default='munich,de'), | |
treshold=dict(required=True, type='float') |
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
#!/usr/bin/env python | |
# coding=utf-8 | |
# | |
# Copyright © 2016 VMware, Inc. All Rights Reserved. | |
# | |
# Licensed under the X11 (MIT) (the “License”) set forth below; | |
# | |
# you may not use this file except in compliance with the License. Unless required by applicable law or agreed to in | |
# writing, software distributed under the License is distributed on an “AS IS” BASIS, without warranties or conditions | |
# of any kind, EITHER EXPRESS OR IMPLIED. See the License for the specific language governing permissions and |
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
#!/usr/bin/env python | |
# coding=utf-8 | |
# | |
# Copyright © 2015-2016 VMware, Inc. All Rights Reserved. | |
# | |
# Licensed under the X11 (MIT) (the “License”) set forth below; | |
# | |
# you may not use this file except in compliance with the License. Unless required by applicable law or agreed to in | |
# writing, software distributed under the License is distributed on an “AS IS” BASIS, without warranties or conditions | |
# of any kind, EITHER EXPRESS OR IMPLIED. See the License for the specific language governing permissions and |
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
#!/usr/bin/env python | |
# coding=utf-8 | |
# | |
# Copyright © 2015-2016 VMware, Inc. All Rights Reserved. | |
# | |
# Licensed under the X11 (MIT) (the “License”) set forth below; | |
# | |
# you may not use this file except in compliance with the License. Unless required by applicable law or agreed to in | |
# writing, software distributed under the License is distributed on an “AS IS” BASIS, without warranties or conditions | |
# of any kind, EITHER EXPRESS OR IMPLIED. See the License for the specific language governing permissions and |