Created
April 25, 2018 09:59
-
-
Save flyudvik/5abe5f1ceca77c459a88f042b19e4e2a to your computer and use it in GitHub Desktop.
Pickle and unpickle session. Good to save the request sessions for cli app without making authentication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests, requests.utils, pickle | |
session = requests.session() | |
# Make some calls | |
# save session | |
with open('somefile', 'w') as f: | |
pickle.dump(session, f) | |
# sessiong restore | |
with open('somefile') as f: | |
session = pickle.load(f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment