-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Implement Account login * Update example * Add mocks for API tests
- Loading branch information
Showing
8 changed files
with
266 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,15 +16,15 @@ Contributions are welcome to translate the rest of the fields. | |
|
||
```python | ||
from things_cloud import ThingsClient | ||
from things_cloud.api.account import Account, Credentials | ||
from things_cloud.models import TodoItem | ||
|
||
ACCOUNT = "<your-account-id>" | ||
# current head index of Cloud database (if you know it) | ||
OFFSET = 1234 | ||
# otherwise | ||
OFFSET = None | ||
EMAIL = os.environ["THINGS_EMAIL"] | ||
PASSWORD = os.environ["THINGS_PASSWORD"] | ||
|
||
things = ThingsClient(ACCOUNT, initial_offset=OFFSET) | ||
credentials = Credentials(email=EMAIL, password=PASSWORD) | ||
account = Account.login(credentials) | ||
things = ThingsClient(account) | ||
# create a new project | ||
project = TodoItem(title="Things Cloud Project").as_project() | ||
# push to Things Cloud | ||
|
@@ -40,7 +40,21 @@ todo.today() | |
things.commit(todo) | ||
``` | ||
|
||
See [main.py](main.py). | ||
## Example | ||
|
||
See [main.py](./main.py). | ||
|
||
1. Install dependencies | ||
|
||
```sh | ||
poetry install | ||
``` | ||
|
||
2. Pass your Things Cloud credentials as environment examples to run the example | ||
|
||
```sh | ||
[email protected] THINGS_PASSWORD=your-password python main.py | ||
``` | ||
|
||
### Progress | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.