'How do I get refresh token from spotipy?

I've made python script using spotipy, to get songs and their features from spotify API. The problem is about that, my requests takes so much time, and its running more than 1hour (expiration time of access token). How do I use spotipy refresh token? It's not refreshing automatically I think beacause script freezes, and when I'm trying get response from Spotify developer console it sends error about expiration of token.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source