Giter VIP home page Giter VIP logo

pythonipaddressscraper's Introduction

PythonIpAddressScraper

A short Python script that allows for a computer to get the computer's local and global IP address.

I have a discount internet supplier here in Canada. Sometimes I need to connect remotely to my home computer. However, my ISP does not garuntee a static IP. While it is 'static', it may change for whatever reason and without notice. In addition, my computer is connected via wifi so sometimes after restarts, my computer takes on a new local IP address.

In order to combat these two challenges, I have created a windows task scheduler action to execute the script whenever the computer is started. In addition the script is executed twice a day, once at 12h00 noon and again at 0h00 midnight. Therefore I should never be more than 12 hours away from an update if need be.

The script is set up in such a way to allow the current iteration and the last 4 IPs to be saved. No real reason for this other than I think it's kind of cool to see it when I run it on my laptop.

Setup

In addition to the two files you need some kind of remote access to the output file you can access whenever you need to. I.e. you need a Dropbox account (or similar service). if you just write to, say, the desktop, you on't be able to access the file when you teed to. N'est–ce pas?

Once you create a folder within your online storage service, you then can download the ip.py and PythonIP.xml and place them in your folder that will be reading and writing these IP addresses.

If you are running Python 3.5 (x86) then he only thing you need to do is update the working directory in the PythonIP.xml file. I prefer to do this in an editor, such as Notepad, rather than in Windows Task Scheduler. Simply find the line

<WorkingDirectory>C:\##INSERT WORKING DIRECTORY HERE##</WorkingDirectory>

and change the contents to the actual working directory of the file. E.g C\Users\DropBox\IP\

if you have another edition of pyton installed, then you need to update the following line of the xml as well.

<Command>"C:\Program Files (x86)\Python 3.5\python.exe"</Command>

for Python 3.3

<Command>"C:\Python33\python.exe"</Command>

After that, all you need to do is open Windows Task Scheduler. Open the start menu and type in Task Schedler. Open it. Once open, go to "Action" > "Import Task..." and navigate to PythonIP.xml. You can double check that all the of the settings aer as you want them (Such as adding more time triggeres, or updating once per week, etc.)

pythonipaddressscraper's People

Contributors

seangrogan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.