Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env python
import sys
import os
import netrc
from gmusicapi.api import Api
def main():
path = sys.argv[1]
if not os.path.exists(path):
print "Invalid file path. %s" % path
return
api = Api()
(email, account, password) = netrc.netrc().hosts['google.com']
api.login(email, password)
if not api.is_authenticated():
print "Login Error\n"
return
print "start upload...\n"
upload_info = api.upload(path)
print upload_info
print "upload is completed.\n"
api.logout()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment