Comments (3)
@hearsid
I was able to reproduce this error. When you initializate the DataGovIndia
class with your API_KEY, it downloads the latest meta-data (list of APIs, titles, description etc.) and stores it in memory. Since these are python objects, it is possible that the streamlit cache isn't able to store them.
However, I looked at their documentation, and I was able to make it work by adding an additional kwarg (allow_output_mutation=True
) in the @st.cache
decorator.
This is what I used -
import os
from datagovindia import DataGovIndia
import streamlit as st
API_KEY = os.environ['DATAGOVIN_API_KEY']
@st.cache(allow_output_mutation=True,suppress_st_warning=True)
def getDataGovAdaptor():
return DataGovIndia(API_KEY)
datagovin = getDataGovAdaptor()
result = datagovin.search(description="Wheat",max_results=1,print_results=True)
Here's the output:
Hope this solves your issue!
from datagovindia.
@addypy Thank you for the quick reply, it is working for the first time and then giving this error,
I also think and agree that it may be because @st.cache is not able to store the DataGovIndia in memory, I'm also looking for other options to replicate st.cache functionality.
from datagovindia.
Not sure if this is useful, but if you can't find an alternative, you could try to wrap multiple arguments in the same function - initiate the class with your key, search for the results, and store the output you need.
All the best!
from datagovindia.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from datagovindia.