send-ip


Namesend-ip JSON
Version 0.0.10 PyPI version JSON
download
home_pagehttps://github.com/matiasandina/send_ip
Summarypython package to send its own IP to another machine through ssh
upload_time2024-03-27 17:49:47
maintainerNone
docs_urlNone
authorMatias Andina
requires_pythonNone
licenseMIT License
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Send IP

Python software to configure machines for sending their IP through ssh.

## Installation

You are advised to create a virtual environment for this program:

```
conda create -n "send_ip_env" 
conda activate send_ip_end
```

Run the following to install:

```python
pip3 install send_ip
```

Running from a virtual environment will affect the python path that you supply to `config.yaml`. See information in [Usage](#usage) section.

## Usage

1. Edit the `config.yaml` file to match your destination. These fields will be used to `scp` into the target machine (`user@ip:port` using password `pass` to login).

```yaml
user: target-user
ip: ip-address
pass: target-password
port: target-port #default port is usually 22 
remote-path: target-folder # this folder will be created under /home/user might create errors for not linux users
refresh-freq: 15 # minutes for cron-job
python_path: /path/to/virtualenv/bin/python3 # the python path you supply here will affect where the code runs (e.g., /usr/bin/python3), see docs! 

```
2. Use the pacakge functions, for example:

```
from send_ip.send_ip import *

info_file = create_info()
send_info(info_file)
```

You can save this into a `send_ip_script.py` and schedule this task to run automatically (see below)

## Schedule task

### Cron

You can setup `send_ip_script.py` to run on a schedule (e.g., every 15 minutes). For example, this is the configuration for a raspberry pi (`pi`) sending its IP to another machine (`matias`) using `config.yaml`.

```
from send_ip.setup_cron import setup_cron
setup_cron("/home/pi/send_ip/send_ip_script.py",15)
Current cron tab (same as $ crontab -l)
--------------------------------------

*/15 * * * * cd python3 /home/pi/send_ip/ && /home/pi/send_ip/send_ip_script.py # send ip to matias

```


### Windows machines

Please refer to [this example](https://stackoverflow.com/a/59079452/3215940) and file issues if having trouble.

## For developers of `send_ip`

To install `send_ip` and tools needed for tests, you can install into a virtualenvironment like so:

```bash
pip install -e .[dev]
```
## Known issues

For a Raspberry pi installation, you might face this issue:

```
          =============================DEBUG ASSISTANCE=============================
          If you are seeing a compilation error please try the following steps to
          successfully install bcrypt:
          1) Upgrade to the latest pip and try again. This will fix errors for most
             users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
          2) Ensure you have a recent Rust toolchain installed. bcrypt requires
             rustc >= 1.56.0.
      
          Python: 3.9.2
          platform: Linux-5.15.56-v7l+-armv7l-with-glibc2.31
          pip: n/a
          setuptools: 65.5.0
          setuptools_rust: 1.5.2
          rustc: n/a
          =============================DEBUG ASSISTANCE=============================
      

```

You might need:

```
sudo apt-get install build-essential cargo
```

You can also refer to this info in [bcrypt](https://pypi.org/project/bcrypt/).

You might also need to install or upgrade `rustc`

```
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```

**Don't forget to restart your shell after installation of rust!!**

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/matiasandina/send_ip",
    "name": "send-ip",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Matias Andina",
    "author_email": "Matias Andina <matiasandina@gmail.com>",
    "download_url": null,
    "platform": null,
    "description": "# Send IP\n\nPython software to configure machines for sending their IP through ssh.\n\n## Installation\n\nYou are advised to create a virtual environment for this program:\n\n```\nconda create -n \"send_ip_env\" \nconda activate send_ip_end\n```\n\nRun the following to install:\n\n```python\npip3 install send_ip\n```\n\nRunning from a virtual environment will affect the python path that you supply to `config.yaml`. See information in [Usage](#usage) section.\n\n## Usage\n\n1. Edit the `config.yaml` file to match your destination. These fields will be used to `scp` into the target machine (`user@ip:port` using password `pass` to login).\n\n```yaml\nuser: target-user\nip: ip-address\npass: target-password\nport: target-port #default port is usually 22 \nremote-path: target-folder # this folder will be created under /home/user might create errors for not linux users\nrefresh-freq: 15 # minutes for cron-job\npython_path: /path/to/virtualenv/bin/python3 # the python path you supply here will affect where the code runs (e.g., /usr/bin/python3), see docs! \n\n```\n2. Use the pacakge functions, for example:\n\n```\nfrom send_ip.send_ip import *\n\ninfo_file = create_info()\nsend_info(info_file)\n```\n\nYou can save this into a `send_ip_script.py` and schedule this task to run automatically (see below)\n\n## Schedule task\n\n### Cron\n\nYou can setup `send_ip_script.py` to run on a schedule (e.g., every 15 minutes). For example, this is the configuration for a raspberry pi (`pi`) sending its IP to another machine (`matias`) using `config.yaml`.\n\n```\nfrom send_ip.setup_cron import setup_cron\nsetup_cron(\"/home/pi/send_ip/send_ip_script.py\",15)\nCurrent cron tab (same as $ crontab -l)\n--------------------------------------\n\n*/15 * * * * cd python3 /home/pi/send_ip/ && /home/pi/send_ip/send_ip_script.py # send ip to matias\n\n```\n\n\n### Windows machines\n\nPlease refer to [this example](https://stackoverflow.com/a/59079452/3215940) and file issues if having trouble.\n\n## For developers of `send_ip`\n\nTo install `send_ip` and tools needed for tests, you can install into a virtualenvironment like so:\n\n```bash\npip install -e .[dev]\n```\n## Known issues\n\nFor a Raspberry pi installation, you might face this issue:\n\n```\n          =============================DEBUG ASSISTANCE=============================\n          If you are seeing a compilation error please try the following steps to\n          successfully install bcrypt:\n          1) Upgrade to the latest pip and try again. This will fix errors for most\n             users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip\n          2) Ensure you have a recent Rust toolchain installed. bcrypt requires\n             rustc >= 1.56.0.\n      \n          Python: 3.9.2\n          platform: Linux-5.15.56-v7l+-armv7l-with-glibc2.31\n          pip: n/a\n          setuptools: 65.5.0\n          setuptools_rust: 1.5.2\n          rustc: n/a\n          =============================DEBUG ASSISTANCE=============================\n      \n\n```\n\nYou might need:\n\n```\nsudo apt-get install build-essential cargo\n```\n\nYou can also refer to this info in [bcrypt](https://pypi.org/project/bcrypt/).\n\nYou might also need to install or upgrade `rustc`\n\n```\ncurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\n```\n\n**Don't forget to restart your shell after installation of rust!!**\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "python package to send its own IP to another machine through ssh",
    "version": "0.0.10",
    "project_urls": {
        "Homepage": "https://github.com/matiasandina/send_ip"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d8ad6b0059e1b0eb72e6ab30af9ac41e4e7d62ecf52c8c362cc6b428320d6f4d",
                "md5": "bc7703300c872b24b03cf05c680c7759",
                "sha256": "62f83ee480d15e97d3835a58bedf3da7d37bc116fdff3abb19f4f6a6e7d9eb56"
            },
            "downloads": -1,
            "filename": "send_ip-0.0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bc7703300c872b24b03cf05c680c7759",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6160,
            "upload_time": "2024-03-27T17:49:47",
            "upload_time_iso_8601": "2024-03-27T17:49:47.124907Z",
            "url": "https://files.pythonhosted.org/packages/d8/ad/6b0059e1b0eb72e6ab30af9ac41e4e7d62ecf52c8c362cc6b428320d6f4d/send_ip-0.0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-27 17:49:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "matiasandina",
    "github_project": "send_ip",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "send-ip"
}
        
Elapsed time: 0.49670s