Private GIT

Skip to content
Snippets Groups Projects
Unverified Commit 75c68d6b authored by rmarchant's avatar rmarchant Committed by GitHub
Browse files

Merge pull request #8 from fmonthel/master

[ENH] Add Travis and Pytest (rename mandatory)
parents d77857f8 62f50816
No related branches found
No related tags found
No related merge requests found
{
"language": "python",
"python": "2.7",
"install": [
"pip install -r requirements.txt"
],
"script": [
"pytest"
],
"group": "stable",
"dist": "trusty",
"os": "linux"
}
...@@ -9,14 +9,13 @@ The config-template.txt file should be renamed to config.txt, and modified with ...@@ -9,14 +9,13 @@ The config-template.txt file should be renamed to config.txt, and modified with
Every time the script runs, it will query an external service to retrieve the external IP of the machine, compare it to the current A record in the zone at gandi.net, and then update the record if the IP has changed. Every time the script runs, it will query an external service to retrieve the external IP of the machine, compare it to the current A record in the zone at gandi.net, and then update the record if the IP has changed.
Requirements: Requirements:
- ipaddress module (pip install ipaddress)
- requests module (pip install requests) pip install -r requirements.txt
- json module (pip install json)
You can then run the script as a cron job : You can then run the script as a cron job :
``` ```
*/15 * * * * python /home/user/gandi-ddns.py */15 * * * * python /home/user/gandi_ddns.py
``` ```
macOS macOS
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<key>ProgramArguments</key> <key>ProgramArguments</key>
<array> <array>
<string>/usr/local/bin/python3</string> <string>/usr/local/bin/python3</string>
<string>gandi-ddns.py</string> <string>gandi_ddns.py</string>
</array> </array>
<key>RunAtLoad</key> <key>RunAtLoad</key>
......
configparser
ipaddress
requests
\ No newline at end of file
import gandi_ddns as script
import requests
def test_get_ip():
assert script.get_ip() == requests.get("http://ipecho.net/plain?").text
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment