zoukankan      html  css  js  c++  java
  • 删除用户

    Delete Account:
    
    curl -v -X DELETE -H "Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd" -H 'Accept: application/json; indent=4' https://cloud.seafile.com/api2/accounts/newaccount@gmail.com/
    
    def del_account():
        token = gettoken()
        token = 'Token' + ' ' + token
        print token
        url = 'http://192.168.137.1:8000/api2/accounts/scan@gmail.com/'
        #data = {'password': '654321'}
        #post_data = urllib.urlencode(data)  # 将post消息化成可以让服务器编码的方式
        request = urllib2.Request(url)
        headers = {"Authorization": token, "Accept": "application/json; indent=10", "content-type": "application/json"}
        # request.add_header("Authorization", token, "Accept", "application/json; indent=10", "content-type", "application/json")
        request.add_header('Authorization', token)
        request.add_header('Accept', 'application/json; indent=10')
        request.add_header('content-type', 'application/x-www-form-urlencoded')
        request.get_method = lambda: 'DELETE'
        response = urllib2.urlopen(request)
    if __name__ == '__main__':
        del_account()
    
    C:Python27python.exe C:/Users/TLCB/PycharmProjects/untitled/mycompany/a8.py
    {"token": "0ac9e8585ef6ae51eb62c785d10a6c5102de3ff7"}
    <type 'str'>
    <type 'dict'>
    0ac9e8585ef6ae51eb62c785d10a6c5102de3ff7
    Token 0ac9e8585ef6ae51eb62c785d10a6c5102de3ff7
    
    Process finished with exit code 0

  • 相关阅读:
    0109. Convert Sorted List to Binary Search Tree (M)
    03.Linux基础操作
    02windows基础操作
    API接口幂问题
    RocketMQ
    zookeeper
    JVM之参数调优
    JAVA多线程之线程池
    计算机网络常见问题
    英语词性之名词
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349581.html
Copyright © 2011-2022 走看看