Skip to content

Commit 75a6307

Browse files
authored
Merge pull request #33 from coingecko/release-please--branches--main--changes--next
release: 1.11.1
2 parents 966849e + 2357c43 commit 75a6307

5 files changed

Lines changed: 50 additions & 19 deletions

File tree

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "1.11.0"
2+
".": "1.11.1"
33
}

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 1.11.1 (2025-10-06)
4+
5+
Full Changelog: [v1.11.0...v1.11.1](https://github.com/coingecko/coingecko-python/compare/v1.11.0...v1.11.1)
6+
7+
### Bug Fixes
8+
9+
* Incorrect snippet in ReadMe ([d956a5c](https://github.com/coingecko/coingecko-python/commit/d956a5cd13af9fcc5711fc5e3698cf100ac7142a))
10+
311
## 1.11.0 (2025-10-06)
412

513
Full Changelog: [v1.10.1...v1.11.0](https://github.com/coingecko/coingecko-python/compare/v1.10.1...v1.11.0)

README.md

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -83,26 +83,28 @@ You can enable this by installing `aiohttp`:
8383

8484
```sh
8585
# install from PyPI
86-
pip install coingecko_sdk[aiohttp]
86+
pip install "coingecko_sdk[aiohttp]"
8787
```
8888

8989
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
9090

9191
```python
92+
import os
9293
import asyncio
9394
from coingecko_sdk import DefaultAioHttpClient
9495
from coingecko_sdk import AsyncCoingecko
9596

9697

9798
async def main() -> None:
9899
async with AsyncCoingecko(
99-
pro_api_key="My Pro API Key",
100+
pro_api_key=os.environ.get("COINGECKO_PRO_API_KEY"),
100101
http_client=DefaultAioHttpClient(),
101102
) as client:
102103
price = await client.simple.price.get(
103104
vs_currencies="usd",
104105
ids="bitcoin",
105106
)
107+
print(price["bitcoin"].usd)
106108

107109

108110
asyncio.run(main())
@@ -127,16 +129,22 @@ response), a subclass of `coingecko_sdk.APIStatusError` is raised, containing `s
127129
All errors inherit from `coingecko_sdk.APIError`.
128130

129131
```python
132+
import os
130133
import coingecko_sdk
131134
from coingecko_sdk import Coingecko
132135

133-
client = Coingecko()
136+
client = Coingecko(
137+
pro_api_key=os.environ.get("COINGECKO_PRO_API_KEY"),
138+
# demo_api_key=os.environ.get("COINGECKO_DEMO_API_KEY"), # Optional, for Demo API access
139+
environment="pro", # "demo" to initialize the client with Demo API access
140+
)
134141

135142
try:
136-
client.simple.price.get(
143+
price = client.simple.price.get(
137144
vs_currencies="usd",
138145
ids="bitcoin",
139146
)
147+
print(price["bitcoin"].usd)
140148
except coingecko_sdk.APIConnectionError as e:
141149
print("The server could not be reached")
142150
print(e.__cause__) # an underlying Exception, likely raised within httpx.
@@ -170,19 +178,24 @@ Connection errors (for example, due to a network connectivity problem), 408 Requ
170178
You can use the `max_retries` option to configure or disable retry settings:
171179

172180
```python
181+
import os
173182
from coingecko_sdk import Coingecko
174183

175184
# Configure the default for all requests:
176185
client = Coingecko(
177-
# default is 2
178-
max_retries=0,
186+
pro_api_key=os.environ.get("COINGECKO_PRO_API_KEY"),
187+
# demo_api_key=os.environ.get("COINGECKO_DEMO_API_KEY"), # Optional, for Demo API access
188+
environment="pro", # "demo" to initialize the client with Demo API access
189+
190+
max_retries=0, # default is 2
179191
)
180192

181193
# Or, configure per-request:
182-
client.with_options(max_retries=5).simple.price.get(
194+
price = client.with_options(max_retries=5).simple.price.get(
183195
vs_currencies="usd",
184196
ids="bitcoin",
185197
)
198+
print(price["bitcoin"].usd)
186199
```
187200

188201
### Timeouts
@@ -191,24 +204,29 @@ By default requests time out after 1 minute. You can configure this with a `time
191204
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
192205

193206
```python
207+
import os
194208
from coingecko_sdk import Coingecko
195209

196210
# Configure the default for all requests:
197211
client = Coingecko(
198-
# 20 seconds (default is 1 minute)
199-
timeout=20.0,
212+
pro_api_key=os.environ.get("COINGECKO_PRO_API_KEY"),
213+
# demo_api_key=os.environ.get("COINGECKO_DEMO_API_KEY"), # Optional, for Demo API access
214+
environment="pro", # "demo" to initialize the client with Demo API access
215+
216+
timeout=20.0, # 20 seconds (default is 1 minute)
200217
)
201218

202219
# More granular control:
203-
client = Coingecko(
204-
timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),
205-
)
220+
# client = Coingecko(
221+
# timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),
222+
# )
206223

207224
# Override per-request:
208-
client.with_options(timeout=5.0).simple.price.get(
225+
price = client.with_options(timeout=5.0).simple.price.get(
209226
vs_currencies="usd",
210227
ids="bitcoin",
211228
)
229+
print(price["bitcoin"].usd)
212230
```
213231

214232
On timeout, an `APITimeoutError` is thrown.
@@ -246,14 +264,19 @@ if response.my_field is None:
246264
The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,
247265

248266
```py
267+
import os
249268
from coingecko_sdk import Coingecko
250269

251-
client = Coingecko()
270+
client = Coingecko(
271+
pro_api_key=os.environ.get("COINGECKO_PRO_API_KEY"),
272+
# demo_api_key=os.environ.get("COINGECKO_DEMO_API_KEY"), # Optional, for Demo API access
273+
environment="pro", # "demo" to initialize the client with Demo API access
274+
)
252275
response = client.simple.price.with_raw_response.get(
253276
vs_currencies="usd",
254277
ids="bitcoin",
255278
)
256-
print(response.headers.get('X-My-Header'))
279+
print(response.headers.get('YOUR-HEADER-NAME'))
257280

258281
price_data = response.parse() # get the object that `simple.price.get()` would have returned
259282
print(price_data['bitcoin'].usd)
@@ -274,7 +297,7 @@ with client.simple.price.with_streaming_response.get(
274297
vs_currencies="usd",
275298
ids="bitcoin",
276299
) as response:
277-
print(response.headers.get("X-My-Header"))
300+
print(response.headers.get("YOUR-HEADER-NAME"))
278301

279302
for line in response.iter_lines():
280303
print(line)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "coingecko_sdk"
3-
version = "1.11.0"
3+
version = "1.11.1"
44
description = "The official Python library for the coingecko API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"

src/coingecko_sdk/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
__title__ = "coingecko_sdk"
4-
__version__ = "1.11.0" # x-release-please-version
4+
__version__ = "1.11.1" # x-release-please-version

0 commit comments

Comments
 (0)