Dynamic DNS With Your Own Domain Name And Webfaction

I have been moving more of my websites hosting over to my Webfaction account. It has been a good experience overall and the service there is much more powerful than what I get with my GoDaddy hosting account.

Yesterday I found in the support forums a nice little script that allows me to use one of my domain names (or subdomain) and re-direct the DNS settings to my local computer. This way I can remotely connect to my home computer with SSH/HTTP/FTP etc. using a url that I will remember.

This is going to be useful as I am writing some Python Django web applications.

Here’s the script:

import urllib2
import xmlrpclib
import os
 
currentip = urllib2.urlopen('http://www.whatismyip.org').read()
 
if not os.path.isfile('lastip'):
    f = open('lastip', 'w')
    f.close()
 
with open('lastip', 'r') as f:
    lastip = f.read()
 
if lastip != currentip:
    server = xmlrpclib.ServerProxy('https://api.webfaction.com/')
    session_id, account = server.login('USERNAME', 'PASSWORD')
    server.delete_dns_override(session_id, 'YOURDOMAIN.com')
    server.create_dns_override(session_id, 'YOURDOMAIN.com', currentip, '', '', '', '')
 
    with open('lastip', 'w') as f:
        f.write(currentip)
 
    print('IP updated to %s' % currentip)
else:
    print('IP not updated')

Once this is run, I can update my router settings to forward the appropriate services to my computer and give the DNS servers enough time to propagate the new entry.

I can now connect to my Home computer using my own domain name. Pretty cool.

Bookmark and Share

Related posts:

  1. Reading and Writing Adwords Editor CSV files in Python
  2. Python Web Crawler Script
  3. Scrape Google Search Results Page
  4. Targeting Twitter Trends Script
  5. Advanced Bit.ly Link Tracking Techniques
Stumble it!


3 Tweets

RSS feed | Trackback URI

3 Comments »

Comment by halotis
2010-02-16 06:01:11

Dynamic DNS With Your Own Domain Name And Webfaction – I have been moving more of my websites hosting over to my We.. http://bit.ly/a1j1v0

This comment was originally posted on Twitter

 
Comment by Vigoth
2010-03-01 03:02:05

Dynamic DNS With Your Own Domain Name And Webfaction – I have been moving more of my websites hosting over to my We.. http://bit.ly/cxnkIO

This comment was originally posted on Twitter

 
Comment by ms4py
2010-04-28 16:58:26

Never heard of http://www.dyndns.com/ ?

 
Name (required)
E-mail (required - never shown publicly)
URI
Subscribe to comments via email
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped=""> in your comment.

Additional comments powered by BackType