Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def user_config(config_complete_path, auth):
config = ConfigParser()
config.read(config_complete_path)
username = input('Type in your Twitter username: ')
try:
auth_url = auth.get_authorization_url()
except tweepy.TweepError:
error(config_complete_path, 'Failed to get request token.')
msg_auth_link = 'Access this link to authorize usage of your Twitter account: ' + bold(lightpurple(auth_url))
if(pyperclip.is_available()):
msg_auth_link += ' (URL automatically copied to clipboard)'
pyperclip.copy(auth_url)
print(msg_auth_link)
verifier = input('Type in the verifier code available on the authorization link: ')
try:
access_token, access_secret = auth.get_access_token(verifier)
except tweepy.TweepError:
error(config_complete_path, 'Failed to get access token.')
config[username] = {'AccessToken':access_token, 'AccessSecret':access_secret}
with open(config_complete_path, 'w') as configfile:
config.write(configfile)
return access_token, access_secret