Skip to content

Instantly share code, notes, and snippets.

@attakei
Created December 13, 2012 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save attakei/4277440 to your computer and use it in GitHub Desktop.
Save attakei/4277440 to your computer and use it in GitHub Desktop.
value-domain.com向けのDDNSクライアント(やっつけ感満載) サインインし忘れて張ってしまった、https://gist.github.com/4277425 の貼り直し
#!/usr/bin/env python
import urllib
import urllib2
import re
DDNS_HTTP_URL = 'http://dyn.value-domain.com/cgi-bin/dyn.fcg'
TARGET_BASE_PARAM = {
'd':'example.com',
'p':'password',
'h':'subdomain',
'i':'ip-address'
}
def main():
ip_search = re.search('<input type=text name=i value=(?P<ipaddr>[0-9.]+)>', \
urllib2.urlopen(DDNS_HTTP_URL).read()).group('ipaddr')
param = dict(TARGET_BASE_PARAM, i=ip_search)
uri = DDNS_HTTP_URL + '?' + urllib.urlencode(param)
print 'REQUEST: ' + uri
print urllib2.urlopen(uri).read()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment