Browse Source

Update doc

fix
Laurent Kislaire 3 years ago
parent
commit
da5618af2e
  1. 18
      README.md
  2. 2
      pyfbx/__main__.py

18
README.md

@ -17,20 +17,21 @@ A script called pyfbx is installed and can be used like this:
To register the application:
```shell
pyfbx SuperAppId
$ pyfbx SuperAppId
```
Once registration is done on the device, write down the application token.
Using this app token, acquire a session token to execute a test command
Using this app token, acquire a session token to execute a test command.
```shell
pyfbx -t '<TOKEN>' SuperAppId
$ pyfbx -t '<TOKEN>' SuperAppId
$ pyfbx -t 'f:<TOKEN_FILE>' SuperAppId
```
You can also store the token in a file (example token.txt) and also execute a specific command
You can run any commands on the freebox and retrieve complete result or single value
```shell
pyfbx -t f:/home/foo/token.txt SuperAppId -c 'Contacts.Create_a_contact(\
$ pyfbx -t f:/home/foo/token.txt SuperAppId -c 'Contacts.Create_a_contact(\
post_data={"display_name": "Sandy Kilo", "first_name": "Sandy", "last_name":"Kilo"})'
{ 'birthday': '',
'company': '',
@ -41,13 +42,17 @@ post_data={"display_name": "Sandy Kilo", "first_name": "Sandy", "last_name":"Kil
'last_update': 1554378898,
'notes': '',
'photo_url': ''}
$ pyfbx -t f:token.txt -u https://0s2efr3i.fbxos.fr:15628 id -c "Connection.Get_the_current_Connection_status()['rate_up']"
1700
```
_Note_ : Don't forget to escape token and command with quotes.
The complete script help is:
```shell
pyfbx -h
usage: pyfbx [-h] [-c COMMAND] [-t TOKEN] [-v] [-n] app_id
usage: pyfbx [-h] [-c COMMAND] [-t TOKEN] [-v] [-n] [-u URL] app_id
positional arguments:
app_id application identifier
@ -61,6 +66,7 @@ optional arguments:
token (or f:<filename>)
-v, --verbose increase verbosity to INFO, use twice for DEBUG
-n, --http Disable MDNS and use http known address
-u URL, --url URL specific url to query
```
## Library usage

2
pyfbx/__main__.py

@ -29,7 +29,7 @@ def main():
parser.add_argument("-v", "--verbose", action="count", default=0,
help="increase verbosity to INFO, use twice for DEBUG")
parser.add_argument("-n", "--http", action="store_true",
help="Disable MDNS and use http known address")
help="disable MDNS and use http known address")
parser.add_argument("-u", "--url", type=str,
help="specific url to query",
default=None)

Loading…
Cancel
Save