使用python怎么創(chuàng)建一個(gè)seafile 目錄?很多新手對(duì)此不是很清楚,為了幫助大家解決這個(gè)難題,下面小編將為大家詳細(xì)講解,有這方面需求的人可以來(lái)學(xué)習(xí)下,希望你能有所收獲。
具體如下:
# !/usr/bin/env python # -*- coding: utf-8 -*- import urllib2 import urllib import cookielib import json import httplib import re import requests import StringIO import time import sys import json import re s = requests.session() username='015208@zjtlcb.com' password='newja01' myurl='http://10.4.48.2:8000/accounts/login?next=/' headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0' } response = s.get(myurl, headers=headers,timeout=10) a= response.content #<form action="" method="post" class="con"><input type='hidden' name='csrfmiddlewaretoken' value='ZWnUDf5XVX0kagjIoJLKyU8UdO8KBGFn' /> #p=re.compile('.*?<token>(.*?)</token>*') p=re.compile('.*<form.*value=\'(.*?)\'.*\s+/>',flags=re.S) m=p.match(a) print m token= m.group(1) print token myurl='http://10.4.48.2:8000/accounts/login/?next=/' headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0' } data={'csrfmiddlewaretoken':token,'login':username,'password':password,'next':'/'} response = s.post(myurl, data=data, headers=headers,timeout=10) print response.content u1='http://10.4.48.2:8000/api2/repos/?type=mine&_=1553493865054' a= s.get(u1).content print a print type(a) b=json.loads(a) print b print type(b) for i in range(len(b)): print str(b[i]).decode('unicode-escape') ##創(chuàng)建目錄 u2='http://10.4.48.2:8000/api2/repos/?from=web' headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0', 'X-CSRFToken':token, 'Content-Type':'application/json;charset=utf-8' } data={"name":"perl","encrypted":"false","passwd1":"","passwd2":"","passwd":"","id":"null","desc":"","mtime" :0,"mtime_relative":"","owner":"-","owner_nickname":"-"} response = s.post(u2, data=json.dumps(data), headers=headers,timeout=10) print response.content
看完上述內(nèi)容是否對(duì)您有幫助呢?如果還想對(duì)相關(guān)知識(shí)有進(jìn)一步的了解或閱讀更多相關(guān)文章,請(qǐng)關(guān)注創(chuàng)新互聯(lián)成都網(wǎng)站設(shè)計(jì)公司行業(yè)資訊頻道,感謝您對(duì)創(chuàng)新互聯(lián)成都網(wǎng)站設(shè)計(jì)公司的支持。
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、網(wǎng)站設(shè)計(jì)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。
本文名稱:使用python怎么創(chuàng)建一個(gè)seafile目錄-創(chuàng)新互聯(lián)
文章鏈接:http://vcdvsql.cn/article28/jecjp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供云服務(wù)器、定制網(wǎng)站、域名注冊(cè)、微信小程序、Google、小程序開發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容