Skip to content

Commit 7d8037c

Browse files
committed
Get API key from environment variable
1 parent fd5275a commit 7d8037c

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,5 @@ Run tests in pipenv environment:
2020
pipenv run python3 -m pytest
2121
```
2222

23-
Tests require a SCUTTLE API key with full permissions. This key should be the
24-
contents of `token.secret.txt` which is to be placed in the test directory. Do
25-
make sure it's in the gitignore.
23+
Tests require a SCUTTLE API key with full permissions. Tests will look for this
24+
key in the `SCUTTLE_API_KEY` environment variable.

test/test_api.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
#!/usr/bin/env python3
22

3+
import os
34
import pytest
45
import scuttle
56

6-
TOKEN = None
7-
with open("token.secret.txt", 'r') as token_file:
8-
TOKEN = token_file.readline().strip()
7+
TOKEN = os.environ['SCUTTLE_API_KEY']
98

109
def test_something():
1110
wiki = scuttle.scuttle('en', 1)

0 commit comments

Comments
 (0)