# [FlyThings Client](http://flythings.io)
## Getting Started
To use this client is necesary:
* Install [Python](https://www.python.org/) (>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3*)
* Install [pip](https://pypi.python.org/pypi/pip?)
* To Install our library:
```BASH
$ pip install flythings
````
And now start to test the flythings clients.
## Documentation
### Configuration File
The general properties configuration in Configuration.properties:
* user: (Optional) user email or identifier to login on the system.
* password: (Optional) the user password to login, is not recommended use this configuration.
* server: (Optional, Default beta.flythings.io/api) configure the server url to insert the data.
* token: (Optional) the user token to send data into flythings plataform.
* device: (Optional) the device which sends data.
* sensor: (Optional) the sensor wich sends data.
* login_type: (Optional) type of login to use.
* timeout: (Optional) request timeout in seconds.
* authorization: (Optional) authorization token.
* Example of configuration file
```JSON
SERVER:beta.flythings.io/api
USER:<put your username here>
PASSWORD:<put your password here>
DEVICE:Python
SENSOR:Client
LOGIN_TYPE:USER or DEVICE
TIMEOUT: 1000
AUTHORIZATION: <put your token here>
```
To load the data from the file call this function:
- **load_data_by_file**(String file)
**Description**: Loads data from the file.
**Return**: Nothing.
**Examples**:
* Loads config data from a file.
```PYTHON import flythings as fly fly.loadDataByFile("/home/xxxx/configuration.properties")
```
You can also introduce this general properties using the library methods.
### General Module Configuration Methods
- **set_server**(String server)
**Description**: Sets the server to which the requests will be sent.
**Return**: Returns a string representing the server.
- **set_device**(String device, (Optional) object=None, always_update=False)
**Params**:
- device: (Mandatory) Device name.
- object: (Optional) Object with extra device params.
- always_update: (Optional) Indicates if must send a request to create/update the device.
```PYTHON
object = {
"type": "CUSTOM",
"geom": {
"type": "Point",
"crs": "4326",
"coordinates": [
-19.323204, 27.611808
]
} }
```
**Description**: Sets the device of the observation. Uses a file named .foiCache to get a fast access to most used
devices.
**Return**: Returns a string representing the device.
- **set_sensor**(String sensor)
**Description**: Sets the sensor of the observation.
**Return**: Returns a string representing the sensor.
- **set_token**(String token)
**Description**: Sets the x-auth-token to authenticate into the server.
**Return**: Returns a string representing the token.
- **set_worskapce**(Long workspace)
**Description**: Sets user workspace
**Return**: Returns the user workspace
- **set_custom_header**(String header, String header_value)
**Description**: Sets a custom header for server requests.
**Return**: Returns a string representing the header.
- **get_headers**(String header, String header_value)
**Description**: Return current headers.
**Return**: Return current headers.
- **set_timeout**(int timeout)
**Description**: Sets the timeout value in seconds to the server requests.
**Return**: Returns an integer representing the timeout.
- **login**(String user, String password, String login_type ['USER' or 'DEVICE'])
**Description**: Authenticate against the server.
**Return**: Returns a string representing the token or None if login fails.
- **logout**()
**Description**: Logout against the server.
**Return**: Returns None.
- **set_authorization_token**(token)
**Description**: Sets bearer token on authorization hearer.
**Return**: returns the authorization header value.
### Modules documentation
- [InsertionModule](docs/InsertionModule.md)
- [RealTimeModule](docs/RealTimeModule.md)
- [ActionModule](docs/ActionModule.md)
- [PredictionModule](docs/PredictionModule.md)
- [SosModule](docs/SosModule.md)
- [UtilModule](docs/UtilModule.md)
### Tests
In the test folder, after fill in the Configuration.Properties file write on bash:
```BASH
nosetests flythingsTest.py
```
([Nose python library is needed](http://nose.readthedocs.io/en/latest/))
### Change log
- [Change log](changelog.md)
## [License](LICENSE)
**Developed by [ITG](http://www.itg.es)**
Raw data
{
"_id": null,
"home_page": "https://github.com/flythings/python",
"name": "flythings",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "flythings, IoT",
"author": "flythings",
"author_email": "fly@itg.es",
"download_url": "https://files.pythonhosted.org/packages/af/84/2ce53fcdaa9f7753e6ed0c5809dea823af4b42bfad48356bd9f03a421754/flythings-2.2.8.zip",
"platform": null,
"description": "# [FlyThings Client](http://flythings.io)\r\n\r\n## Getting Started\r\n\r\nTo use this client is necesary:\r\n\r\n* Install [Python](https://www.python.org/) (>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3*)\r\n* Install [pip](https://pypi.python.org/pypi/pip?)\r\n* To Install our library:\r\n\r\n```BASH \r\n $ pip install flythings \r\n```` \r\n\r\nAnd now start to test the flythings clients.\r\n\r\n## Documentation\r\n\r\n### Configuration File\r\n\r\nThe general properties configuration in Configuration.properties:\r\n\r\n* user: (Optional) user email or identifier to login on the system.\r\n* password: (Optional) the user password to login, is not recommended use this configuration.\r\n* server: (Optional, Default beta.flythings.io/api) configure the server url to insert the data.\r\n* token: (Optional) the user token to send data into flythings plataform.\r\n* device: (Optional) the device which sends data.\r\n* sensor: (Optional) the sensor wich sends data.\r\n* login_type: (Optional) type of login to use.\r\n* timeout: (Optional) request timeout in seconds.\r\n* authorization: (Optional) authorization token.\r\n* Example of configuration file\r\n\r\n```JSON \r\n SERVER:beta.flythings.io/api \r\n USER:<put your username here> \r\n PASSWORD:<put your password here> \r\n DEVICE:Python \r\n SENSOR:Client \r\n LOGIN_TYPE:USER or DEVICE\r\n TIMEOUT: 1000\r\n AUTHORIZATION: <put your token here> \r\n``` \r\n\r\nTo load the data from the file call this function:\r\n\r\n- **load_data_by_file**(String file) \r\n **Description**: Loads data from the file. \r\n **Return**: Nothing.\r\n\r\n**Examples**:\r\n\r\n* Loads config data from a file.\r\n ```PYTHON import flythings as fly fly.loadDataByFile(\"/home/xxxx/configuration.properties\")\r\n ```\r\n\r\nYou can also introduce this general properties using the library methods.\r\n\r\n### General Module Configuration Methods\r\n\r\n- **set_server**(String server) \r\n **Description**: Sets the server to which the requests will be sent. \r\n **Return**: Returns a string representing the server.\r\n\r\n- **set_device**(String device, (Optional) object=None, always_update=False) \r\n **Params**:\r\n - device: (Mandatory) Device name.\r\n - object: (Optional) Object with extra device params.\r\n - always_update: (Optional) Indicates if must send a request to create/update the device. \r\n ```PYTHON\r\n object = {\r\n \"type\": \"CUSTOM\",\r\n \"geom\": {\r\n \"type\": \"Point\",\r\n \"crs\": \"4326\",\r\n \"coordinates\": [\r\n -19.323204, 27.611808\r\n ]\r\n } }\r\n ``` \r\n **Description**: Sets the device of the observation. Uses a file named .foiCache to get a fast access to most used\r\n devices. \r\n **Return**: Returns a string representing the device.\r\n\r\n- **set_sensor**(String sensor) \r\n **Description**: Sets the sensor of the observation. \r\n **Return**: Returns a string representing the sensor.\r\n\r\n- **set_token**(String token) \r\n **Description**: Sets the x-auth-token to authenticate into the server. \r\n **Return**: Returns a string representing the token.\r\n \r\n- **set_worskapce**(Long workspace) \r\n **Description**: Sets user workspace \r\n **Return**: Returns the user workspace\r\n\r\n- **set_custom_header**(String header, String header_value) \r\n **Description**: Sets a custom header for server requests. \r\n **Return**: Returns a string representing the header.\r\n\r\n- **get_headers**(String header, String header_value) \r\n **Description**: Return current headers. \r\n **Return**: Return current headers.\r\n\r\n- **set_timeout**(int timeout) \r\n **Description**: Sets the timeout value in seconds to the server requests. \r\n **Return**: Returns an integer representing the timeout.\r\n\r\n- **login**(String user, String password, String login_type ['USER' or 'DEVICE']) \r\n **Description**: Authenticate against the server. \r\n **Return**: Returns a string representing the token or None if login fails.\r\n \r\n- **logout**() \r\n **Description**: Logout against the server. \r\n **Return**: Returns None.\r\n \r\n- **set_authorization_token**(token)\r\n **Description**: Sets bearer token on authorization hearer.\r\n **Return**: returns the authorization header value.\r\n\r\n### Modules documentation\r\n\r\n- [InsertionModule](docs/InsertionModule.md)\r\n- [RealTimeModule](docs/RealTimeModule.md)\r\n- [ActionModule](docs/ActionModule.md)\r\n- [PredictionModule](docs/PredictionModule.md)\r\n- [SosModule](docs/SosModule.md)\r\n- [UtilModule](docs/UtilModule.md)\r\n\r\n### Tests\r\n\r\nIn the test folder, after fill in the Configuration.Properties file write on bash:\r\n\r\n```BASH \r\n nosetests flythingsTest.py \r\n``` \r\n\r\n([Nose python library is needed](http://nose.readthedocs.io/en/latest/))\r\n\r\n### Change log\r\n\r\n- [Change log](changelog.md)\r\n\r\n## [License](LICENSE)\r\n\r\n**Developed by [ITG](http://www.itg.es)**\r\n\r\n \r\n",
"bugtrack_url": null,
"license": "GPL-3.0",
"summary": "A python library to add ans search observations into flythings",
"version": "2.2.8",
"project_urls": {
"Download": "https://github.com/flythings/python/2.2.8.tar.gz",
"Homepage": "https://github.com/flythings/python"
},
"split_keywords": [
"flythings",
" iot"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "af842ce53fcdaa9f7753e6ed0c5809dea823af4b42bfad48356bd9f03a421754",
"md5": "fe504a6b71d8db30a1d734cb460acc62",
"sha256": "a23948f936c8ae406efddf647359f2a6901b647cf8e8246f12b5055dce8a36c3"
},
"downloads": -1,
"filename": "flythings-2.2.8.zip",
"has_sig": false,
"md5_digest": "fe504a6b71d8db30a1d734cb460acc62",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 29096,
"upload_time": "2024-05-28T11:49:49",
"upload_time_iso_8601": "2024-05-28T11:49:49.188191Z",
"url": "https://files.pythonhosted.org/packages/af/84/2ce53fcdaa9f7753e6ed0c5809dea823af4b42bfad48356bd9f03a421754/flythings-2.2.8.zip",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-28 11:49:49",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "flythings",
"github_project": "python",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "flythings"
}