Skip to content

Commit 33d9cd4

Browse files
committed
MOD: Rename Access Key -> API Key across docs
1 parent 74ace37 commit 33d9cd4

23 files changed

+52
-52
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@ To install the latest stable version of the package from PyPI:
4242
pip install -U databento
4343

4444
## Usage
45-
The library needs to be configured with an access key from your account.
45+
The library needs to be configured with an API key from your account.
4646
[Sign up](https://databento.com/signup) for free and you will automatically
47-
receive a set of access keys to start with. Each access key is a 28-character
48-
string that can be found on the Access Keys page of your [Databento user portal](https://databento.com/platform/keys).
47+
receive a set of API keys to start with. Each API key is a 28-character
48+
string that can be found on the API Keys page of your [Databento user portal](https://databento.com/platform/keys).
4949

5050
A simple Databento application looks like this:
5151

5252
```python
5353
import databento as db
5454

55-
client = db.Historical('YOUR_ACCESS_KEY')
55+
client = db.Historical('YOUR_API_KEY')
5656
data = client.timeseries.stream(
5757
dataset='GLBX.MDP3',
5858
start='2020-11-02T14:30',
@@ -61,7 +61,7 @@ data = client.timeseries.stream(
6161
data.replay(callback=print) # market replay, with `print` as event handler
6262
```
6363

64-
Replace `YOUR_ACCESS_KEY` with an actual access key, then run this program.
64+
Replace `YOUR_API_KEY` with an actual API key, then run this program.
6565

6666
This uses `.replay()` to access the entire block of data
6767
and dispatch each data event to an event handler. You can also use
@@ -72,15 +72,15 @@ df = data.to_df(pretty_ts=True, pretty_px=True) # to DataFrame, with pretty for
7272
array = data.to_ndarray() # to ndarray
7373
```
7474

75-
Note that the access key was also passed as a parameter, which is
76-
[not recommended for production applications](https://docs0.databento.com/knowledge-base/new-users/securing-your-access-keys?historical=python&live=python).
77-
Instead, you can leave out this parameter to pass your access key via the `DATABENTO_ACCESS_KEY` environment variable:
75+
Note that the API key was also passed as a parameter, which is
76+
[not recommended for production applications](https://docs0.databento.com/knowledge-base/new-users/securing-your-api-keys?historical=python&live=python).
77+
Instead, you can leave out this parameter to pass your API key via the `DATABENTO_API_KEY` environment variable:
7878

7979
```python
8080
import databento as db
8181

82-
client = db.Historical('YOUR_ACCESS_KEY') # pass as parameter
83-
client = db.Historical() # pass as `DATABENTO_ACCESS_KEY` environment variable
82+
client = db.Historical('YOUR_API_KEY') # pass as parameter
83+
client = db.Historical() # pass as `DATABENTO_API_KEY` environment variable
8484
```
8585

8686
## License

databento/historical/client.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ class Historical:
1919
Parameters
2020
----------
2121
key : str, optional
22-
The API user access key for authentication.
23-
If ``None`` then the `DATABENTO_ACCESS_KEY` environment variable is used.
22+
The user API key for authentication.
23+
If ``None`` then the `DATABENTO_API_KEY` environment variable is used.
2424
gateway : HistoricalGateway or str, default HistoricalGateway.NEAREST
2525
The API server gateway.
2626
If ``None`` then the default gateway is used.
2727
2828
Examples
2929
--------
3030
> import databento as db
31-
> client = db.Historical('YOUR_ACCESS_KEY')
31+
> client = db.Historical('YOUR_API_KEY')
3232
"""
3333

3434
def __init__(
@@ -37,9 +37,9 @@ def __init__(
3737
gateway: Union[HistoricalGateway, str] = HistoricalGateway.NEAREST,
3838
):
3939
if key is None:
40-
key = os.environ.get("DATABENTO_ACCESS_KEY")
40+
key = os.environ.get("DATABENTO_API_KEY")
4141
if key is None or not isinstance(key, str) or key.isspace():
42-
raise ValueError(f"invalid API access key, was {key}")
42+
raise ValueError(f"invalid API key, was {key}")
4343

4444
# Configure data access gateway
4545
gateway = enum_or_str_lowercase(gateway, "gateway")
@@ -60,7 +60,7 @@ def __init__(
6060
@property
6161
def key(self) -> str:
6262
"""
63-
Return the API user access key for the client.
63+
Return the user API key for the client.
6464
6565
Returns
6666
-------

databento/historical/http.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ def _create_bento(path: str) -> Union[MemoryBento, FileBento]:
7878
else:
7979
return FileBento(path=path)
8080

81-
def _check_access_key(self):
82-
if self._key == "YOUR_ACCESS_KEY":
81+
def _check_api_key(self):
82+
if self._key == "YOUR_API_KEY":
8383
raise ValueError(
84-
"The access key is currently set to 'YOUR_ACCESS_KEY'. "
85-
"Please replace this value with a valid access key. "
84+
"The API key is currently set to 'YOUR_API_KEY'. "
85+
"Please replace this value with a valid API key. "
8686
"You can find these through your Databento user portal.",
8787
)
8888

@@ -92,7 +92,7 @@ def _get(
9292
params: Optional[List[Tuple[str, str]]] = None,
9393
basic_auth: bool = False,
9494
) -> Response:
95-
self._check_access_key()
95+
self._check_api_key()
9696

9797
with requests.get(
9898
url=url,
@@ -112,7 +112,7 @@ async def _get_async(
112112
params: Optional[List[Tuple[str, str]]] = None,
113113
basic_auth: bool = False,
114114
) -> ClientResponse:
115-
self._check_access_key()
115+
self._check_api_key()
116116
async with aiohttp.ClientSession() as session:
117117
async with session.get(
118118
url=url,
@@ -132,7 +132,7 @@ def _post(
132132
params: Optional[List[Tuple[str, str]]] = None,
133133
basic_auth: bool = False,
134134
) -> Response:
135-
self._check_access_key()
135+
self._check_api_key()
136136

137137
with requests.post(
138138
url=url,
@@ -153,7 +153,7 @@ def _stream(
153153
basic_auth: bool,
154154
bento: Bento,
155155
) -> None:
156-
self._check_access_key()
156+
self._check_api_key()
157157

158158
with requests.get(
159159
url=url,
@@ -189,7 +189,7 @@ async def _stream_async(
189189
basic_auth: bool,
190190
bento: Bento,
191191
) -> None:
192-
self._check_access_key()
192+
self._check_api_key()
193193

194194
async with aiohttp.ClientSession() as session:
195195
async with session.get(

examples/historical_batch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
if __name__ == "__main__":
77
db.log = "debug" # optional debug logging
88

9-
key = "YOUR_ACCESS_KEY"
9+
key = "YOUR_API_KEY"
1010
client = db.Historical(key=key)
1111

1212
response = client.batch.timeseries_submit(

examples/historical_metadata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
if __name__ == "__main__":
55
db.log = "debug" # optional debug logging
66

7-
key = "YOUR_ACCESS_KEY"
7+
key = "YOUR_API_KEY"
88
client = db.Historical(key=key)
99

1010
print(client.metadata.list_publishers())

examples/historical_metadata_get_billable_size.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
if __name__ == "__main__":
55
db.log = "debug" # optional debug logging
66

7-
key = "YOUR_ACCESS_KEY"
7+
key = "YOUR_API_KEY"
88
client = db.Historical(key=key)
99

1010
size: int = client.metadata.get_billable_size(

examples/historical_metadata_get_cost.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
if __name__ == "__main__":
55
db.log = "debug" # optional debug logging
66

7-
key = "YOUR_ACCESS_KEY"
7+
key = "YOUR_API_KEY"
88
client = db.Historical(key=key)
99

1010
cost1: float = client.metadata.get_cost(

examples/historical_metadata_get_shape.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
if __name__ == "__main__":
77
db.log = "debug" # optional debug logging
88

9-
key = "YOUR_ACCESS_KEY"
9+
key = "YOUR_API_KEY"
1010
client = db.Historical(key=key)
1111

1212
shape: Tuple = client.metadata.get_shape(

examples/historical_metadata_list_unit_price.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
if __name__ == "__main__":
77
db.log = "debug" # optional debug logging
88

9-
key = "YOUR_ACCESS_KEY"
9+
key = "YOUR_API_KEY"
1010
client = db.Historical(key=key)
1111

1212
unit_prices = client.metadata.list_unit_prices(

examples/historical_symbology_resolve.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
if __name__ == "__main__":
88
db.log = "debug" # optional debug logging
99

10-
key = "YOUR_ACCESS_KEY"
10+
key = "YOUR_API_KEY"
1111
client = db.Historical(key=key)
1212

1313
response = client.symbology.resolve(

0 commit comments

Comments
 (0)