You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a method that I can close the SSL connection which is build by Subgrounds? I checked the API document which doesn't have a similar content.
I tried to close it with contextlib, but it also can't solve this problem.
# Import the Subgrounds library
from subgrounds import Subgrounds
from contextlib import closing
import os
def another_function():
# load_dotenv()
graph_api_key = '<REDACTED>'
# Create a new Subgrounds object
with closing(Subgrounds()) as sg:
# Load the Uniswap v3 subgraph using a specific API endpoint
uni = sg.load_subgraph(
f'https://gateway.thegraph.com/api/{graph_api_key}/subgraphs/id/ELUcwgpm14LKPLrBRuVvPvNKHQ9HvwmtKgKSH6123cr7')
# <REDACTED>
# Query the financialsDailySnapshots endpoint with a specified order, limit, and filter criteria
latest_snapshots = uni.Query.financialsDailySnapshots(
orderBy=uni.FinancialsDailySnapshot.timestamp,
orderDirection='desc',
first=1,
)
# Convert the query results to a Pandas dataframe and extract the first row
res = sg.query_df(latest_snapshots).squeeze()
pass
print("Another function")
another_function()
which would give me two error message:
AttributeError: 'Subgrounds' object has no attribute 'close'
I can't close it like this.
That's the real problem. When the program end, PY just simply terminate everything and trigger this error. I can read data from this, but how to safely close the connection?
The text was updated successfully, but these errors were encountered:
There's no need to utilize contextlib.closing for this purpose, it won't add anything extra to the with Subgrounds() as sg behavior.
Unfortuntely, this SSL socket warning has crept up in a recent update to subgrounds and I haven't fully figured out where it came from. It can safely be ignored and won't affect anything and if the messages get in the way, you can use the warnings module to ignore them from the output:
Is there a method that I can close the SSL connection which is build by Subgrounds? I checked the API document which doesn't have a similar content.
I tried to close it with contextlib, but it also can't solve this problem.
which would give me two error message:
That's the real problem. When the program end, PY just simply terminate everything and trigger this error. I can read data from this, but how to safely close the connection?
The text was updated successfully, but these errors were encountered: