def resultDisplay(): #intialisation client = Client(application_id=medium_app_id, application_secret=medium_app_secret) #post="Post" #client._request(post,"https://86acd90c.ngrok.io/resultDisplay/") # Build the URL where you can send the user to obtain an authorization code. auth_url = client.get_authorization_url( "secretstate", "{}/resultDisplay/callback/medium".format(ngrok_link), ["basicProfile", "publishPost", "listPublications"]) # auth = client.exchange_authorization_code(print(auth_url),"https://b351e15d.ngrok.io/resultDisplay/callback/medium") return redirect(auth_url, code=302)
if __name__ == '__main__': do_auth = True get_home_articles() if do_auth: # Go to http://medium.com/me/applications to get your application_id and application_secret. client = Client(application_id=MEDIUM_CLIENT_ID, application_secret=MEDIUM_CLIENT_SECRET) # Build the URL where you can send the user to obtain an authorization code. auth_url = client.get_authorization_url( "secretstate", callback_url, ["basicProfile", "publishPost", "listPublications"]) # (Send the user to the authorization URL to obtain an authorization code.) print(auth_url) webbrowser.open(auth_url, new=2) print( "Authorization code (at the end of the url that was just opened):") authorization_code = sys.stdin.readline().strip() # Exchange the authorization code for an access token. auth = client.exchange_authorization_code(authorization_code, callback_url)