Skip to content

Commit 765d68e

Browse files
authored
Update Auth and temp coefficient docs (#318)
* update temp coeff description closes #316 * update auth docs
1 parent f99bba6 commit 765d68e

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

sfa_api/schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ class Meta:
190190
temperature_coefficient = ma.Float(
191191
title="Temperature Coefficient",
192192
description=("The temperature coefficient of DC power in units of "
193-
"1/C. Typically -0.002 to -0.005 per degree C."),
193+
"%/C. Typically -0.2 to -0.5 %/C."),
194194
required=True,
195195
default=None
196196
)

sfa_api/spec.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,13 @@ def decorator(schema):
254254
A valid response will resemble:
255255
256256
```json
257-
{"access_token":"BASE64_ENCODED_JWT","expires_in":10800,"token_type":"Bearer"}
257+
{
258+
"access_token":"BASE64_ENCODED_JWT",
259+
"id_token": "ENCODED_ID_INFORMATION",
260+
"scope": "openid profile email",
261+
"expires_in":10800,
262+
"token_type":"Bearer"
263+
}
258264
```
259265
260266
Requests to the API need to send the access token in the Authorization header:
@@ -264,8 +270,24 @@ def decorator(schema):
264270
--url "https://api.solarforecastarbiter.org/endpoint"
265271
```
266272
267-
Extracting and using the access token might look like:
273+
Extracting an access token into an environment variable and
274+
using it to retrieve data from the api might look like:
275+
276+
Using GNU grep and awk:
277+
```
278+
export ACCESS_TOKEN=\\
279+
$(curl -s --request POST \\
280+
--url 'https://solarforecastarbiter.auth0.com/oauth/token' \\
281+
--header 'content-type: application/json' \\
282+
--data '{"grant_type": "password", "username": "[email protected]", "password": "Thepassword123!", "audience": "https://api.solarforecastarbiter.org", "client_id": "c16EJo48lbTCQEhqSztGGlmxxxmZ4zX7"}'\\
283+
| grep -oP '"access_token"\:"\K[^"]+'\\
284+
| awk '{ print $1 }' )
285+
286+
curl --header "Authorization: Bearer $ACCESS_TOKEN" \\
287+
--url "https://api.solarforecastarbiter.org/observations/"
288+
```
268289
290+
Using the jq utility available at: https://stedolan.github.io/jq/.
269291
```
270292
export ACCESS_TOKEN=\\
271293
$(curl -s --request POST \\
@@ -277,7 +299,7 @@ def decorator(schema):
277299
curl --header "Authorization: Bearer $ACCESS_TOKEN" \\
278300
--url "https://api.solarforecastarbiter.org/observations/"
279301
```
280-
The jq utility can be obtained at https://stedolan.github.io/jq/.
302+
281303
282304
Python users may want to use a libarary like
283305
[Authlib](https://docs.authlib.org/en/latest/client/oauth2.html#oauth2session-for-password)

0 commit comments

Comments
 (0)