AlphaSense API SDK
Project description
AlphaSense API SDK
Installation
Before installing; you should create the virtual environment
pip install alphasense-api-sdk
or specify the version
pip install alphasense-api-sdk==0.1.0
Or adding the alphasense-api-sdk
to the pyproject.toml
file
dependencies = [
"alphasense-api-sdk==0.1.0"
]
or requirements.txt
file
alphasense-api-sdk==0.1.0
Usage
- Create
pyproject.toml
file - Add the following to the
pyproject.toml
file
[alphasense.auth]
username = "<your username>"
password = "<your password>"
api_key = "<your api key>"
client_id = "<your client id>"
client_secret = "<your client secret>"
- Writing the code to fetch the watchlists with raw GraphQL query
from alphasense_api_sdk.client import Client, GraphQLField
async def main():
client = Client()
w = await client.query(
GraphQLField("user { watchlists { id name }}"), operation_name="user_watchlists"
)
print("Watchlists: ", w)
if __name__ == "__main__":
import asyncio
asyncio.run(main())
- Or using the
Query
object to search for documents
from alphasense_api_sdk.client import Client, GraphQLField
from alphasense_api_sdk.custom_queries import Query, SearchResponseFields
async def main():
client = Client()
df = SearchResponseFields.documents()
search_query = Query.search(limit=5).fields(
SearchResponseFields.documents().fields(
df.id,
df.title,
df.released_at,
GraphQLField("type { ids }"),
)
)
docs = await client.query(search_query, operation_name="searchDocs")
print("> docs: ", docs)
if __name__ == "__main__":
import asyncio
asyncio.run(main())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
alphasense_api_sdk-0.1.10.tar.gz
(21.6 kB
view details)
Built Distribution
File details
Details for the file alphasense_api_sdk-0.1.10.tar.gz
.
File metadata
- Download URL: alphasense_api_sdk-0.1.10.tar.gz
- Upload date:
- Size: 21.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d6917db8080fd93d31d01a6300bf28c1b6a2321c0d5c8f7f5aeb3d155095383 |
|
MD5 | 3f4e8d50a9410a17f36bf5a8f4ff3e0f |
|
BLAKE2b-256 | 42d54520bb0826e653a75f3b36ff738e267002578e451815f4cd583ead4b7bb5 |
File details
Details for the file alphasense_api_sdk-0.1.10-py2.py3-none-any.whl
.
File metadata
- Download URL: alphasense_api_sdk-0.1.10-py2.py3-none-any.whl
- Upload date:
- Size: 24.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66230968b82bf9bed0d9339f9f4a801f1bceefe503c6c34c65413c4b6ef30964 |
|
MD5 | d162975d20ab632dd075333abb6c80a6 |
|
BLAKE2b-256 | e829973d68dca9e68c5f962c966477699240d8f927aa1b9e571730356a3d7eaf |