Reputation: 1200
I have this code:
import nsepython
import warnings
warnings.filterwarnings("ignore")
print(nse_quote_ltp("RELIANCE"))
This code puts out this warning before printing out the result:
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): www.nseindia.com:443 DEBUG:urllib3.connectionpool:https://www.nseindia.com:443 "GET /api/equity-stockIndices?index=SECURITIES%20IN%20F%26O HTTP/1.1" 200 26695 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): www.nseindia.com:443 DEBUG:urllib3.connectionpool:https://www.nseindia.com:443 "GET /api/quote-derivative?symbol=RELIANCE HTTP/1.1" 200 38950 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): www.nseindia.com:443 DEBUG:urllib3.connectionpool:https://www.nseindia.com:443 "GET /api/equity-stockIndices?index=SECURITIES%20IN%20F%26O HTTP/1.1" 200 26695 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): www.nseindia.com:443 DEBUG:urllib3.connectionpool:https://www.nseindia.com:443 "GET /api/quote-derivative?symbol=RELIANCE HTTP/1.1" 200 38950
2387
How can i turn off this warning?
Upvotes: 0
Views: 254
Reputation: 1717
You have your logging level set to DEBUG, and if you're using a framework like Flask, it will use Python's built-in logging mechanism to output its messages at the appropriate level. Try this instead:
import nsepython
import warnings
import logging
logging.basicConfig(level=logging.ERROR)
warnings.filterwarnings("ignore")
print(nse_quote_ltp("RELIANCE"))
Upvotes: 3