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

Changing default state of noauth_local_webserver?

$
0
0

I'm currently making a GUI YouTube video uploader for my community, but since I don't want all of my users to get my client_id and client_secret, I encoded them. Problem is that whenever program runs (it's not being run from command line using parameters, it gets those informations from Tkinter GUI) it start to authenticate users via web link, which contains real client_id and client_secret. I tried to use --noauth_local_webserver parameter but without success, since nothing is being run from command-line (I haven't found way to run this parameter without command line). As I saw on official docs, this parameter is set to "False" by default, is there any way to change that, or is there any way to disable web authentication? This is my code which I use to authenticate and start uploading a video (it's pretty much default one from official docs, with few changes so it fits my needs):

def get_authenticated_service():    makeitreal() #this is function which decodes encoded client_id and client_secret    flow = flow_from_clientsecrets(os.path.abspath(os.path.join(os.path.dirname(__file__), "client_secrets.json")), scope=YOUTUBE_UPLOAD_SCOPE,    message=MISSING_CLIENT_SECRETS_MESSAGE)    storage = Storage("%s-oauth2.json" % sys.argv[0])    credentials = storage.get()    if credentials is None or credentials.invalid:       credentials = run(flow, storage)    return build(YOUTUBE_API_SERVICE_NAME, YOUTUBE_API_VERSION,      http=credentials.authorize(httplib2.Http()))def initialize_upload():    makeitreal() #this is function which decodes encoded client_id and client_secret    youtube = get_authenticated_service()    os.remove(os.path.join(os.path.dirname(__file__), "upload_video.py-oauth2.json")) #I use this to remove this json since it's not being used anymore and it contains client_id and client_secret   tags = None   insert_request = youtube.videos().insert(     part="snippet,status",     body=dict(       snippet=dict(         title=video_title, #####         description=video_desc, # These 3 parameters are not being gathered through command line as it was in default code, I changed it so it gets these from Tkinter GUI         tags=video_keywords, ####         categoryId="22"       ),       status=dict(         privacyStatus=VALID_PRIVACY_STATUSES[0]       )      ),# chunksize=-1 means that the entire file will be uploaded in a single# HTTP request. (If the upload fails, it will still be retried where it# left off.) This is usually a best practice, but if you're using Python# older than 2.6 or if you're running on App Engine, you should set the# chunksize to something like 1024 * 1024 (1 megabyte).      media_body=MediaFileUpload(filename, chunksize=-1, resumable=True)   )   makeitfake() #this is function which encodes previously decoded client_id and client_secret   resumable_upload(insert_request) #this function uploads video

Thanks in advance, Amar!


Viewing all articles
Browse latest Browse all 3831

Trending Articles



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