|
| 1 | +# Web Status Monitor |
| 2 | +> This project develops a web status monitor (simplified version of uptimerobot.com) to practice web programming and understand the web related protocols: HTTP and TLS/SSL. |
| 3 | +> - Implements HTTP client socket to interact with the web server |
| 4 | +> - Doesn't use any existing HTTP client library |
| 5 | +> - Uses an existing SSL library to help implement the HTTPS client (extra credit) |
| 6 | +
|
| 7 | +## Requirements |
| 8 | +- [x] <a target="_blank" href="https://docs.continuum.io/free/anaconda/install">Anaconda</a> **OR** <a target="_blank" href="https://docs.conda.io/projects/miniconda/en/latest">Miniconda</a> |
| 9 | + |
| 10 | +> [!TIP] |
| 11 | +> If you have trouble deciding between Anaconda and Miniconda, please refer to the table below: |
| 12 | +> <table> |
| 13 | +> <thead> |
| 14 | +> <tr> |
| 15 | +> <th><center>Anaconda</center></th> |
| 16 | +> <th><center>Miniconda</center></th> |
| 17 | +> </tr> |
| 18 | +> </thead> |
| 19 | +> <tbody> |
| 20 | +> <tr> |
| 21 | +> <td>New to conda and/or Python</td> |
| 22 | +> <td>Familiar with conda and/or Python</td> |
| 23 | +> </tr> |
| 24 | +> <tr> |
| 25 | +> <td>Not familiar with using terminal and prefer GUI</td> |
| 26 | +> <td>Comfortable using terminal</td> |
| 27 | +> </tr> |
| 28 | +> <tr> |
| 29 | +> <td>Like the convenience of having Python and 1,500+ scientific packages automatically installed at once</td> |
| 30 | +> <td>Want fast access to Python and the conda commands and plan to sort out the other programs later</td> |
| 31 | +> </tr> |
| 32 | +> <tr> |
| 33 | +> <td>Have the time and space (a few minutes and 3 GB)</td> |
| 34 | +> <td>Don't have the time or space to install 1,500+ packages</td> |
| 35 | +> </tr> |
| 36 | +> <tr> |
| 37 | +> <td>Don't want to individually install each package</td> |
| 38 | +> <td>Don't mind individually installing each package</td> |
| 39 | +> </tr> |
| 40 | +> </tbody> |
| 41 | +> </table> |
| 42 | +> |
| 43 | +> Typing out entire Conda commands can sometimes be tedious, so I wrote a shell script ([`conda_shortcuts.sh` on GitHub Gist](https://gist.github.com/lynkos/7a4ce7f9e38bb56174360648461a3dc8)) to define shortcuts for commonly used Conda commands. |
| 44 | +> <details> |
| 45 | +> <summary>Example: Delete/remove a conda environment named <code>test_env</code></summary> |
| 46 | +> |
| 47 | +> * Shortcut command |
| 48 | +> ``` |
| 49 | +> rmenv test_env |
| 50 | +> ``` |
| 51 | +> * Manually typing out the entire command |
| 52 | +> ```sh |
| 53 | +> conda env remove -n test_env && rm -rf $(conda info --base)/envs/test_env |
| 54 | +> ``` |
| 55 | +> |
| 56 | +> The shortcut has 80.8% fewer characters! |
| 57 | +> </details> |
| 58 | +
|
| 59 | +## Installation |
| 60 | +1. Verify that conda is installed |
| 61 | + ``` |
| 62 | + conda --version |
| 63 | + ``` |
| 64 | +
|
| 65 | +2. Ensure conda is up to date |
| 66 | + ``` |
| 67 | + conda update conda |
| 68 | + ``` |
| 69 | +
|
| 70 | +3. Enter the directory you want `web-status-monitor` to be cloned in |
| 71 | + * POSIX |
| 72 | + ```sh |
| 73 | + cd ~/path/to/directory |
| 74 | + ``` |
| 75 | + * Windows |
| 76 | + ```sh |
| 77 | + cd C:\Users\user\path\to\directory |
| 78 | + ``` |
| 79 | +
|
| 80 | +4. Clone and enter `web-status-monitor` |
| 81 | + ```sh |
| 82 | + git clone https://github.com/lynkos/web-status-monitor.git && cd web-status-monitor |
| 83 | + ``` |
| 84 | + |
| 85 | +5. Create virtual environment from [`environment.yml`](environment.yml) |
| 86 | + ```sh |
| 87 | + conda env create -f environment.yml |
| 88 | + ``` |
| 89 | + |
| 90 | +## Usage |
| 91 | +<ol> |
| 92 | + <li>Activate <code>monitor</code> (i.e., virtual environment)<pre>conda activate monitor</pre></li> |
| 93 | + <li>Confirm <code>monitor</code> is active |
| 94 | + <ul> |
| 95 | + <li><code>monitor</code> should be in parentheses () or brackets [] before your command prompt, e.g.<pre>(monitor) $</pre></li> |
| 96 | + <li>See which virtual environments are available and/or currently active (active environment denoted with asterisk (*))<pre>conda info --envs</pre> <b>OR</b> <pre>conda env list</pre></li> |
| 97 | + </ul> |
| 98 | + </li> |
| 99 | + <li>Run <a href="monitor.py"><code>monitor.py</code></a> (<code>urls_file</code> is the path to a file containing a list of URLs)<pre>python monitor.py urls_file</pre></li> |
| 100 | + <li>Deactivate <code>monitor</code> (i.e., virtual environment) when finished<pre>conda deactivate</pre></li> |
| 101 | +</ol> |
0 commit comments