Answer the question
In order to leave comments, you need to log in
How to copy an object for further use?
Hello!
Have a function
@csrf_exempt
def tw(request):
if request.method == 'GET':
auth = tweepy.OAuthHandler(consumer_key, consumer_secret, callback_url)
return redirect(auth.get_authorization_url())
<tweepy.auth.OAuthHandler object at 0x7f0de94f2a20>
auth.get_access_token(tw_verifier)
Answer the question
In order to leave comments, you need to log in
Store it in memory, like a cache. If there is a reachable link to it, you can get it and GC will not crash it. If there are several workers (and it usually is), then the cache must be used external. For example, Redis or memcached. Here you will need pickle to pack the object.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question