2017-08-16 114 views
0

我想通過python在我自己的雲上放置一些圖片。如何將圖像放在owncloud上?

這裏有一些代碼可以把txt,但我不知道如何把我的圖像(PNG)放在owncloud上。

import owncloud 
oc = owncloud.Client('http://domain.tld/owncloud') 
oc.login('user', 'password') 
oc.mkdir('testdir') 
oc.put_file('testdir/remotefile.txt', 'localfile.txt') 
link_info = oc.share_file_with_link('testdir/remotefile.txt') 
print "Here is your link: " + link_info.get_link() 

感謝您的回覆!

回答

0
def test(): 
    import owncloud 

    oc = owncloud.Client('http://1.1.6.115') 

    oc.login('aaa', 'aaa') 
    try: 
     oc.mkdir('test') 
    except: 
     print 'do not create fold' 
    oc.put_file('test/test.png',u"K:/123/test.png") 

    link_info = oc.share_file_with_link('test/test.png') 

我明白了。