HI team,
Got a quick question, If the streamlit app contains the use of any API (stock, twitter, etc), would this be considered a valid submission? Or does the app needs to have experimental_connection (eg, sqliteDB, MySQL, etc)
Many thanks!
HI team,
Got a quick question, If the streamlit app contains the use of any API (stock, twitter, etc), would this be considered a valid submission? Or does the app needs to have experimental_connection (eg, sqliteDB, MySQL, etc)
Many thanks!
Hi @tonykip,
I’m a bit unsure about how to approach creating connections for APIs that already have a good Python client. My understanding is that the main goal of streamlit connections is to streamline secret management and caching. In that case, it could make sense to have a connections factory function that automatically wraps given APIs to manage secrets and add caching to chosen functions.
For example, the connection factory and its application to the elasticsearch Python client would look like:
import streamlit as st
from streamlit.connections import ExperimentalBaseConnection
from collections import ChainMap
from functools import wraps
from elasticsearch import Elasticsearch
def connection_factory(connection_name, python_api_client, func_dict, ttl=60):
@wraps(python_api_client)
def _connect(self, **kwargs):
conn_params = ChainMap(kwargs, self._secrets.to_dict())
return python_api_client(**conn_params)
def cached(func):
@wraps(func)
@st.cache_data(ttl=ttl)
def _func(*args, **kwargs):
return func(*args, **kwargs)
return _func
attributes = {}
attributes["_connect"] = _connect
for name, func in func_dict.items():
attributes[name] = cached(func)
return type(connection_name, (ExperimentalBaseConnection,), attributes)
ElasticsearchConnection = connection_factory("ElasticsearchConnection", Elasticsearch, {
"get": Elasticsearch.get,
"search": Elasticsearch.search,
})
The code likely needs to be improved, but this gives a rough description of the idea.
Would this achieve the goals that Streamlit has in mind for its connections, or is there something I’m missing?
I’ve just submitted my Spoonacular connection
Do I have to utilize the secret toml in addition to kwargs? Lastly do I have to use my own api keys to allow the demo to be functional? Thanks
Hi @OlivierBinette, you are on the right track.
Hi @jlonge4, you can store your keys in the secrets.toml
to test the connection/app…to avoid any unnecessary costs to you, you can let users enter their keys in your app to use the app. For the hackathon, you can do a screen recording and explain the flow and how it works.
Hi @Pavel401, thanks for sharing, and good luck!
Hi @Saurabh_Joshi,
Thanks for posting! If the connection is for an API, then that will be valid; for example a connection for the Twitter API. You would need to create a connection for the API using st.experimental_connection
to qualify.
Thanks for sharing @kerbal, and good luck!
Just submitted my first ChromaDB Connection. Checkout my site at https://app-chromadbconnection-mfzxl3nzozmaxh3mrkd6zm.streamlit.app/. Hope y’all have fun building!!!
Hi @tonykip,
Thanks for sharing and good luck!
Submitted my entry on github API search
Let’s gooo @mliu!
Thanks, @tonykip, got my entry submitted to the hackathon
Ayee good luck!
Hey All, sharing my experimental connection Kaggle-Streamlit, which allows a user to import Kaggle datasets in two lines of code
Hi, @Oleksandr_Arsentiev
Thanks for sharing and good luck!
Hi All, I just submitted my first OpenWeartherMap API Connection. Checkout the app at here
Can you mention the timezone? Will I have to submit the connection on or before 4th August 2023, but what is the time?
Yes, by midnight PST on August 4th.
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.