Skip to content

Commit b8a1de7

Browse files
committed
docs cleanup following bad merge
x
1 parent c468066 commit b8a1de7

File tree

4 files changed

+61
-55
lines changed

4 files changed

+61
-55
lines changed

README.md

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -94,58 +94,67 @@ client = FitbitClient(
9494
client_id="YOUR_CLIENT_ID",
9595
client_secret="YOUR_CLIENT_SECRET",
9696
redirect_uri="YOUR_REGISTERED_REDIRECT_URI",
97-
token_cache_path="/tmp/fb_tokens.json" # Optional: saves tokens between sessions
98-
redirect_uri="YOUR_REGISTERED_REDIRECT_URI",
99-
token_cache_path="/tmp/fb_tokens.json" # Optional: saves tokens between sessions
97+
token_cache_path="/tmp/fb_tokens.json"
10098
)
10199

102100
# Will open browser and handle callback automatically
103101
client.authenticate()
104102
```
105103

106-
The `token_cache_path` parameter allows you to persist authentication tokens
107-
between sessions. If provided, the client will:
104+
You can also load your credentials from a JSON file, which is useful for keeping
105+
secrets out of your code:
108106

109-
1. Load existing tokens from this file if available (avoiding re-authentication)
107+
```python
108+
from json import load
109+
from fitbit_client import FitbitClient
110110

111-
2. Save new or refreshed tokens to this file automatically
111+
# Load credentials from a JSON file
112+
with open("secrets.json") as f:
113+
secrets = load(f)
112114

113-
3. Handle token refresh when expired tokens are detected The `token_cache_path`
114-
parameter allows you to persist authentication tokens between sessions. If
115-
provided, the client will:
115+
# Initialize Fitbit OAuth2 flow and get a client
116+
client = FitbitClient(**secrets)
116117

117-
4. Load existing tokens from this file if available (avoiding re-authentication)
118+
# Authenticate as usual
119+
client.authenticate()
120+
```
118121

119-
5. Save new or refreshed tokens to this file automatically
122+
Where secrets.json contains:
120123

121-
6. Handle token refresh when expired tokens are detected
124+
```json
125+
{
126+
"client_id": "YOUR_CLIENT_ID",
127+
"client_secret": "YOUR_CLIENT_SECRET",
128+
"redirect_uri": "https://localhost:8080"
129+
}
130+
```
122131

123-
## Setting Up Your Fitbit App
132+
You can also include the optional token_cache_path:
124133

125-
1. Go to dev.fitbit.com and create a new application
126-
2. Set OAuth 2.0 Application Type to "Personal"
127-
3. Set Callback URL to "https://localhost:8080" (or your preferred local URL)
128-
4. Set Callback URL to "https://localhost:8080" (or your preferred local URL)
129-
5. Copy your Client ID and Client Secret
134+
```json
135+
{
136+
"client_id": "YOUR_CLIENT_ID",
137+
"client_secret": "YOUR_CLIENT_SECRET",
138+
"redirect_uri": "https://localhost:8080",
139+
"token_cache_path": "/tmp/tokens.json"
140+
}
141+
```
130142

131-
## Additional Documentation
143+
The `token_cache_path` parameter allows you to persist authentication tokens
144+
between sessions. If provided, the client will:
132145

133-
### For API Library Users
146+
1. Load existing tokens from this file if available (avoiding re-authentication)
134147

135-
- [LOGGING.md](docs/LOGGING.md): Understanding the dual-logger system
136-
- [TYPES.md](docs/TYPES.md): JSON type system and method return types
137-
- [NAMING.md](docs/NAMING.md): API method naming conventions
138-
- [VALIDATIONS.md](docs/VALIDATIONS.md): Input parameter validation
139-
- [ERROR_HANDLING.md](docs/ERROR_HANDLING.md): Exception hierarchy and handling
148+
2. Save new or refreshed tokens to this file automatically
140149

141-
It's also worth reviewing
142-
[Fitbit's Best Practices](https://dev.fitbit.com/build/reference/web-api/developer-guide/best-practices/)
143-
for API usage.
150+
3. Handle token refresh when expired tokens are detected
144151

145-
### Project Best Practices
152+
## Setting Up Your Fitbit App
146153

147-
- [DEVELOPMENT.md](docs/DEVELOPMENT.md): Development environment and guidelines
148-
- [STYLE.md](docs/STYLE.md): Code style and formatting standards
154+
1. Go to dev.fitbit.com and create a new application
155+
2. Set OAuth 2.0 Application Type to "Personal"
156+
3. Set Callback URL to "https://localhost:8080" (or your preferred local URL)
157+
4. Copy your Client ID and Client Secret
149158

150159
## Additional Documentation
151160

@@ -178,13 +187,6 @@ The methods are implemented in comments and should work, but I have not had a
178187
chance to verify them since this requires a publicly accessible server to
179188
receive webhook notifications.
180189

181-
If you're using this library with subscriptions and would like to help test and
182-
implement this functionality, please open an issue or pull request!
183-
[webhook subscriptions](https://dev.fitbit.com/build/reference/web-api/developer-guide/using-subscriptions/).
184-
The methods are implemented in comments and should work, but I have not had a
185-
chance to verify them since this requires a publicly accessible server to
186-
receive webhook notifications.
187-
188190
If you're using this library with subscriptions and would like to help test and
189191
implement this functionality, please open an issue or pull request!
190192

TODO.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## TODOs:
44

5+
- be able to set scopes when initializing the client
6+
7+
- security notes
8+
59
- PyPi deployment
610

711
- For all `create_...`methods, add the ID from the response to logs and maybe

docs/DEVELOPMENT.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,19 +77,23 @@ fitbit-client/
7777
│ │ ├── callback_handler.py
7878
│ │ ├── callback_server.py
7979
│ │ └── oauth.py
80-
│ ├── client/
81-
│ │ ├── __init__.py
82-
│ │ ├── fitbit_client.py
83-
│ │ └── resource_methods_mixin.py
80+
│ ├── client.py
8481
│ ├── resources/
8582
│ │ ├── __init__.py
8683
│ │ ├── [resource files]
8784
│ │ └── constants.py
85+
│ ├── utils/
86+
│ │ ├── __init__.py
87+
│ │ ├── curl_debug_mixin.py
88+
│ │ ├── date_validation.py
89+
│ │ ├── helpers.py
90+
│ │ ├── pagination_validation.py
91+
│ │ └── types.py
8892
│ └── exceptions.py
8993
├── tests/
9094
│ ├── auth/
91-
│ ├── client/
92-
│ └── resources/
95+
│ ├── resources/
96+
│ └── utils/
9397
└── [project files]
9498
```
9599

@@ -129,8 +133,8 @@ import typing
129133
import datetime
130134
```
131135

132-
The one excpetion to this rule is when an entire module needs to be `mock`ed for
133-
testing, in which case, at least for the `json` package from the standare
136+
The one exception to this rule is when an entire module needs to be `mock`ed for
137+
testing, in which case, at least for the `json` package from the standard
134138
library, the entire package has to be imported. So `import json` is ok when that
135139
circumstance arises.
136140

@@ -378,10 +382,6 @@ The OAuth callback mechanism is implemented using two main classes:
378382
- Removing temporary certificate files
379383
- Clearing internal state
380384

381-
### Security Notes
382-
383-
TODO
384-
385385
## Git Workflow
386386

387387
1. Create a new branch for your feature/fix
@@ -391,7 +391,7 @@ TODO
391391

392392
## Release Process
393393

394-
TODO
394+
This section will be documented as we near our first release.
395395

396396
## Getting Help
397397

docs/STYLE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
Linting and formatting are handled by [Black](https://github.com/psf/black),
44
[isort](https://github.com/pycqa/isort/),
55
[mdformat](https://github.com/pycqa/isort/),
6-
[autoflake](https://github.com/PyCQA/autoflake) and a \[small script that adds a
7-
path comment)[lint/add_file_headers.py]. That said, here are some general
8-
guidelines:
6+
[autoflake](https://github.com/PyCQA/autoflake) and a
7+
[small script that adds a path comment](lint/add_file_headers.py). That said,
8+
here are some general guidelines:
99

1010
## Code Organization and Structure
1111

0 commit comments

Comments
 (0)