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

  • 相关阅读:
    并发工具类的使用 CountDownLatch,CyclicBarrier,Semaphore,Exchanger
    多线程按顺序执行3个方法
    读写锁事例
    使用AQS自定义重入锁
    java 几种锁实现
    Nginx 安装
    Windows 安装mysql
    day--14前端(HTML、CSS)
    day13--开发堡垒机
    day12--python操作mysql
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349581.html
Copyright © 2011-2022 走看看