Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

How to know if the user completed login or not and close the server in youtube api and python

$
0
0

I want to make a web app using Django and I want to make sure that the user completed login into his youtube account or not because the user may click on the button to go to the page where he can log into his account using this code

flow.run_local_server(port=8080,                               prompt='consent',                              authorization_prompt_message='',                              timeout_seconds=40                              )

and he may don't complete the login process

when I added the timeout secondes argument it works but if the user took more than 40 seconds it raises AttributeError : 'NoneType' object has no attribute 'replace'

and if the user clicks on the button to go to the page where he can log into his youtube account and He back to the previous page and click on the button again it raisesOSError at /channels/ : [WinError 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted

And this error happened because the process of the of login is still runningSo what basically I want to do is two things

first: I want to show a success message if the user successfully logged into his account and I can make the message itself but I need help with "when I will add it"

second: I want to solve the second problem OSError at /channels/ so what exactly I want to add is if the user didn't complete the login process I want to close the server even if the timeout wasn't finished

Please help me even if you just have an idea, not a code

I tried to look at the documentation of the socket and didn't workand I looked at the run_local_server function itself but I didn't find anything that can help me

please note that the flow object is created like this

flow = InstalledAppFlow.from_client_secrets_file('client_secret.json',            scopes=['https://www.googleapis.com/auth/youtube.upload'            ]        )

Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>