zoukankan      html  css  js  c++  java
  • Unstar A File:

    Unstar A File:
    
    curl -X DELETE -v  -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' -H 'Accept: application/json; charset=utf-8; indent=4' 'https://cloud.seafile.com/api2/starredfiles/?repo_id=dae8cecc-2359-4d33-aa42-01b7846c4b32&p=/foo.md'
    
    def unstart_files():
        token = gettoken()
        token = 'Token' + ' ' + token
        print token
        url = 'http://127.0.0.1:8000/api2/starredfiles/?repo_id=afd1a8c0-bbd3-4c71-9068-0068585e7d98&p=/elk网址.txt'
        # 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)
        print response.read()
    if __name__ == '__main__':
        unstart_files()
    
    C:Python27python.exe C:/Users/TLCB/PycharmProjects/untitled/mycompany/a8.py
    {"token": "0ac9e8585ef6ae51eb62c785d10a6c5102de3ff7"}
    <type 'str'>
    <type 'dict'>
    0ac9e8585ef6ae51eb62c785d10a6c5102de3ff7
    Token 0ac9e8585ef6ae51eb62c785d10a6c5102de3ff7
    "success"
    
    Process finished with exit code 0

  • 相关阅读:
    【算法】 冒泡排序
    【算法】 插入排序
    【算法】 斐波那契数列
    【C#】 RBAC 权限框架
    【jQuery】 实用 js
    【jQuery】 Ajax
    【jQuery】 常用函数
    【jQuery】 资料
    【jQuery】 效果
    Linaro/Yocto/Openwrt
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349577.html
Copyright © 2011-2022 走看看