Skip to content

Commit

Permalink
Merge pull request #33 from rcholic/empty
Browse files Browse the repository at this point in the history
check status
  • Loading branch information
rcholic authored Jul 14, 2024
2 parents 62ffac0 + ee4944d commit 2ecf900
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
9 changes: 7 additions & 2 deletions cschwabpy/SchwabAsyncClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,13 @@ async def download_option_chain_async(
response = await client.get(
url=target_url, params={}, headers=self.__auth_header()
)
json_res = response.json()
return OptionChain(**json_res)
if response.status_code == 200:
json_res = response.json()
return OptionChain(**json_res)
else:
raise Exception(
"Failed to download option chain. Status: ", response.status_code
)
finally:
if not self.__keep_client_alive:
await client.aclose()
9 changes: 7 additions & 2 deletions cschwabpy/SchwabClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,13 @@ def download_option_chain(
response = client.get(
url=target_url, params={}, headers=self.__auth_header()
)
json_res = response.json()
return OptionChain(**json_res)
if response.status_code == 200:
json_res = response.json()
return OptionChain(**json_res)
else:
raise Exception(
"Failed to download option chain. Status: ", response.status_code
)
finally:
if not self.__keep_client_alive:
client.close()
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cschwabpy"
version = "0.1.3.2"
version = "0.1.3.3"
description = ""
authors = ["Tony Wang <[email protected]>"]
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="CSchwabPy",
version="0.1.3.2",
version="0.1.3.3",
description="Charles Schwab Stock & Option Trade API Client for Python.",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 2ecf900

Please sign in to comment.