diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-05 11:55:14 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-05 11:55:14 +0000 |
commit | 34ba8a3d37c8382dda84818b9e3c1bde3a825f75 (patch) | |
tree | cec7fef400da7e28d6491bc6ab394b513bdce55b | |
parent | c251c8843209ddcb99cee32c12766c2cbc404534 (diff) |
automatic import of python-pybotvacopeneuler20.03
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-pybotvac.spec | 474 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 476 insertions, 0 deletions
@@ -0,0 +1 @@ +/pybotvac-0.0.24.tar.gz diff --git a/python-pybotvac.spec b/python-pybotvac.spec new file mode 100644 index 0000000..c4ba0bd --- /dev/null +++ b/python-pybotvac.spec @@ -0,0 +1,474 @@ +%global _empty_manifest_terminate_build 0 +Name: python-pybotvac +Version: 0.0.24 +Release: 1 +Summary: Python package for controlling Neato pybotvac Connected vacuum robot +License: Licensed under the MIT license. See LICENSE file for details +URL: https://github.com/stianaske/pybotvac +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/19/2b/a3c65bff64edda23617e861bf1cfac6a6cc03f0791c075c855352e4ad1dc/pybotvac-0.0.24.tar.gz +BuildArch: noarch + +Requires: python3-requests +Requires: python3-requests-oauthlib +Requires: python3-voluptuous + +%description +# pybotvac + +This is an unofficial API for controlling Neato Botvac Connected vacuum robots. +The code is based on https://github.com/kangguru/botvac and credit for reverse engineering the API goes to +[Lars Brillert @kangguru](https://github.com/kangguru) + +## Disclaimer +This API is experimental. Use at your own risk. Feel free to contribute if things are not working. + +## Installation +Install using pip + +```bash +pip install pybotvac +``` + +Alternatively, clone the repository and run + +```bash +python setup.py install +``` + +## Usage +### Robot +If the serial and secret for your robot is known, simply run + +```python +>>> from pybotvac import Robot +>>> robot = Robot('OPS01234-0123456789AB', '0123456789ABCDEF0123456789ABCDEF', 'my_robot_name') +>>> print(robot) +Name: sample_robot, Serial: OPS01234-0123456789AB, Secret: 0123456789ABCDEF0123456789ABCDEF +``` + +The format of the serial should be 'OPSxxxxx-xxxxxxxxxxxx', and the secret should be a string of hex characters 32 characters long. +These can be found by using the Account class. + +To start cleaning + +```python +robot.start_cleaning() +``` + +If no exception occurred, your robot should now get to work. + +Currently the following methods are available in the Robot class: + +* get_robot_state() +* start_cleaning() +* start_spot_cleaning() +* pause_cleaning() +* stop_cleaning() +* send_to_base() +* enable_schedule() +* disable_schedule() +* get_schedule() + +For convenience, properties exist for state and schedule + +```python +# Get state +state = robot.state + +# Check if schedule is enabled +robot.schedule_enabled + +# Disable schedule +robot.schedule_enabled = False +``` + +### Account +If the serial and secret are unknown, they can be retrieved using the Account class. +You need a session instance to create an account. +There are three different types of sessions available. +It depends on your provider which session is suitable for you. + +* **PasswordSession** lets you authenticate via E-Mail and Password. Even though this works fine, it is not recommended. +* **OAuthSession** lets you authenticate via OAuth2. You have to create an application [here](https://developers.neatorobotics.com/applications) in order to generate `client_id`, `client_secret` and `redirect_url`. +* **PasswordlessSession** is known to work for users of the new MyKobold App. The only known `client_id` is `KY4YbVAvtgB7lp8vIbWQ7zLk3hssZlhR`. + +```python +from pybotvac import Account, Neato, OAuthSession, PasswordlessSession, PasswordSession, Vorwerk + +email = "Your email" +password = "Your password" +client_id = "Your client it" +client_secret = "Your client secret" +redirect_uri = "Your redirect URI" + +# Authenticate via Email and Password +password_session = PasswordSession(email=email, password=password, vendor=Neato()) + +# Authenticate via OAuth2 +oauth_session = OAuthSession(client_id=client_id, client_secret=client_secret, redirect_uri=redirect_uri, vendor=Neato()) +authorization_url = oauth_session.get_authorization_url() +print("Visit: " + authorization_url) +authorization_response = input("Enter the full callback URL: ") +token = oauth_session.fetch_token(authorization_response) + +# Authenticate via One Time Password +passwordless_session = PasswordlessSession(client_id=client_id, vendor=Vorwerk()) +passwordless_session.send_email_otp(email) +code = input("Enter the code: ") +passwordless_session.fetch_token_passwordless(email, code) + +# Create an account with one of the generated sessions +account = Account(password_session) + +# List all robots associated with account +for robot in account.robots: + print(robot) +``` + +Information about maps and download of maps can be done from the Account class: + +```python +>>> from pybotvac import Account +>>> # List all maps associated with a specific robot +>>> for map_info in Account(PasswordSession('sample@email.com', 'sample_password')).maps: +... print(map_info) +``` + +A cleaning map can be downloaded with the account class. Returns the raw image response. Example shows latest map. +You need the url from the map output to do that: + +```python +>>> from pybotvac import Account +>>> # List all maps associated with a specific robot +>>> map = Account(PasswordSession('sample@email.com', 'sample_password')).maps +>>> download_link = map['robot_serial']['maps'][0]['url'] +>>> Account('sample@email.com', 'sample_password').get_map_image(download_link) +``` + + + + +%package -n python3-pybotvac +Summary: Python package for controlling Neato pybotvac Connected vacuum robot +Provides: python-pybotvac +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-pybotvac +# pybotvac + +This is an unofficial API for controlling Neato Botvac Connected vacuum robots. +The code is based on https://github.com/kangguru/botvac and credit for reverse engineering the API goes to +[Lars Brillert @kangguru](https://github.com/kangguru) + +## Disclaimer +This API is experimental. Use at your own risk. Feel free to contribute if things are not working. + +## Installation +Install using pip + +```bash +pip install pybotvac +``` + +Alternatively, clone the repository and run + +```bash +python setup.py install +``` + +## Usage +### Robot +If the serial and secret for your robot is known, simply run + +```python +>>> from pybotvac import Robot +>>> robot = Robot('OPS01234-0123456789AB', '0123456789ABCDEF0123456789ABCDEF', 'my_robot_name') +>>> print(robot) +Name: sample_robot, Serial: OPS01234-0123456789AB, Secret: 0123456789ABCDEF0123456789ABCDEF +``` + +The format of the serial should be 'OPSxxxxx-xxxxxxxxxxxx', and the secret should be a string of hex characters 32 characters long. +These can be found by using the Account class. + +To start cleaning + +```python +robot.start_cleaning() +``` + +If no exception occurred, your robot should now get to work. + +Currently the following methods are available in the Robot class: + +* get_robot_state() +* start_cleaning() +* start_spot_cleaning() +* pause_cleaning() +* stop_cleaning() +* send_to_base() +* enable_schedule() +* disable_schedule() +* get_schedule() + +For convenience, properties exist for state and schedule + +```python +# Get state +state = robot.state + +# Check if schedule is enabled +robot.schedule_enabled + +# Disable schedule +robot.schedule_enabled = False +``` + +### Account +If the serial and secret are unknown, they can be retrieved using the Account class. +You need a session instance to create an account. +There are three different types of sessions available. +It depends on your provider which session is suitable for you. + +* **PasswordSession** lets you authenticate via E-Mail and Password. Even though this works fine, it is not recommended. +* **OAuthSession** lets you authenticate via OAuth2. You have to create an application [here](https://developers.neatorobotics.com/applications) in order to generate `client_id`, `client_secret` and `redirect_url`. +* **PasswordlessSession** is known to work for users of the new MyKobold App. The only known `client_id` is `KY4YbVAvtgB7lp8vIbWQ7zLk3hssZlhR`. + +```python +from pybotvac import Account, Neato, OAuthSession, PasswordlessSession, PasswordSession, Vorwerk + +email = "Your email" +password = "Your password" +client_id = "Your client it" +client_secret = "Your client secret" +redirect_uri = "Your redirect URI" + +# Authenticate via Email and Password +password_session = PasswordSession(email=email, password=password, vendor=Neato()) + +# Authenticate via OAuth2 +oauth_session = OAuthSession(client_id=client_id, client_secret=client_secret, redirect_uri=redirect_uri, vendor=Neato()) +authorization_url = oauth_session.get_authorization_url() +print("Visit: " + authorization_url) +authorization_response = input("Enter the full callback URL: ") +token = oauth_session.fetch_token(authorization_response) + +# Authenticate via One Time Password +passwordless_session = PasswordlessSession(client_id=client_id, vendor=Vorwerk()) +passwordless_session.send_email_otp(email) +code = input("Enter the code: ") +passwordless_session.fetch_token_passwordless(email, code) + +# Create an account with one of the generated sessions +account = Account(password_session) + +# List all robots associated with account +for robot in account.robots: + print(robot) +``` + +Information about maps and download of maps can be done from the Account class: + +```python +>>> from pybotvac import Account +>>> # List all maps associated with a specific robot +>>> for map_info in Account(PasswordSession('sample@email.com', 'sample_password')).maps: +... print(map_info) +``` + +A cleaning map can be downloaded with the account class. Returns the raw image response. Example shows latest map. +You need the url from the map output to do that: + +```python +>>> from pybotvac import Account +>>> # List all maps associated with a specific robot +>>> map = Account(PasswordSession('sample@email.com', 'sample_password')).maps +>>> download_link = map['robot_serial']['maps'][0]['url'] +>>> Account('sample@email.com', 'sample_password').get_map_image(download_link) +``` + + + + +%package help +Summary: Development documents and examples for pybotvac +Provides: python3-pybotvac-doc +%description help +# pybotvac + +This is an unofficial API for controlling Neato Botvac Connected vacuum robots. +The code is based on https://github.com/kangguru/botvac and credit for reverse engineering the API goes to +[Lars Brillert @kangguru](https://github.com/kangguru) + +## Disclaimer +This API is experimental. Use at your own risk. Feel free to contribute if things are not working. + +## Installation +Install using pip + +```bash +pip install pybotvac +``` + +Alternatively, clone the repository and run + +```bash +python setup.py install +``` + +## Usage +### Robot +If the serial and secret for your robot is known, simply run + +```python +>>> from pybotvac import Robot +>>> robot = Robot('OPS01234-0123456789AB', '0123456789ABCDEF0123456789ABCDEF', 'my_robot_name') +>>> print(robot) +Name: sample_robot, Serial: OPS01234-0123456789AB, Secret: 0123456789ABCDEF0123456789ABCDEF +``` + +The format of the serial should be 'OPSxxxxx-xxxxxxxxxxxx', and the secret should be a string of hex characters 32 characters long. +These can be found by using the Account class. + +To start cleaning + +```python +robot.start_cleaning() +``` + +If no exception occurred, your robot should now get to work. + +Currently the following methods are available in the Robot class: + +* get_robot_state() +* start_cleaning() +* start_spot_cleaning() +* pause_cleaning() +* stop_cleaning() +* send_to_base() +* enable_schedule() +* disable_schedule() +* get_schedule() + +For convenience, properties exist for state and schedule + +```python +# Get state +state = robot.state + +# Check if schedule is enabled +robot.schedule_enabled + +# Disable schedule +robot.schedule_enabled = False +``` + +### Account +If the serial and secret are unknown, they can be retrieved using the Account class. +You need a session instance to create an account. +There are three different types of sessions available. +It depends on your provider which session is suitable for you. + +* **PasswordSession** lets you authenticate via E-Mail and Password. Even though this works fine, it is not recommended. +* **OAuthSession** lets you authenticate via OAuth2. You have to create an application [here](https://developers.neatorobotics.com/applications) in order to generate `client_id`, `client_secret` and `redirect_url`. +* **PasswordlessSession** is known to work for users of the new MyKobold App. The only known `client_id` is `KY4YbVAvtgB7lp8vIbWQ7zLk3hssZlhR`. + +```python +from pybotvac import Account, Neato, OAuthSession, PasswordlessSession, PasswordSession, Vorwerk + +email = "Your email" +password = "Your password" +client_id = "Your client it" +client_secret = "Your client secret" +redirect_uri = "Your redirect URI" + +# Authenticate via Email and Password +password_session = PasswordSession(email=email, password=password, vendor=Neato()) + +# Authenticate via OAuth2 +oauth_session = OAuthSession(client_id=client_id, client_secret=client_secret, redirect_uri=redirect_uri, vendor=Neato()) +authorization_url = oauth_session.get_authorization_url() +print("Visit: " + authorization_url) +authorization_response = input("Enter the full callback URL: ") +token = oauth_session.fetch_token(authorization_response) + +# Authenticate via One Time Password +passwordless_session = PasswordlessSession(client_id=client_id, vendor=Vorwerk()) +passwordless_session.send_email_otp(email) +code = input("Enter the code: ") +passwordless_session.fetch_token_passwordless(email, code) + +# Create an account with one of the generated sessions +account = Account(password_session) + +# List all robots associated with account +for robot in account.robots: + print(robot) +``` + +Information about maps and download of maps can be done from the Account class: + +```python +>>> from pybotvac import Account +>>> # List all maps associated with a specific robot +>>> for map_info in Account(PasswordSession('sample@email.com', 'sample_password')).maps: +... print(map_info) +``` + +A cleaning map can be downloaded with the account class. Returns the raw image response. Example shows latest map. +You need the url from the map output to do that: + +```python +>>> from pybotvac import Account +>>> # List all maps associated with a specific robot +>>> map = Account(PasswordSession('sample@email.com', 'sample_password')).maps +>>> download_link = map['robot_serial']['maps'][0]['url'] +>>> Account('sample@email.com', 'sample_password').get_map_image(download_link) +``` + + + + +%prep +%autosetup -n pybotvac-0.0.24 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-pybotvac -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 0.0.24-1 +- Package Spec generated @@ -0,0 +1 @@ +59cbd5a2036e008d53423fade556b4ec pybotvac-0.0.24.tar.gz |