soleil0-0/GazelleSync

Upload successfully, but console print out "upload failed".

Closed this issue · 0 comments

Details

  • ret.html is response from login.php

setup debug proxy to find the reason why

# setup debug proxy
npm i -g whistle

# access http://localhost:8899, enable "Capture TUNNEL CONNECTs"

# download root ca
curl -Lo $HOME/rootCA.crt http://localhost:8899/cgi-bin/rootca

# setup env vars to use use debug proxy
export http_proxy=http://localhost:8899; export https_proxy=$http_proxy
export EQUESTS_CA_BUNDLE=$HOME/rootCA.crt
python -c "import requests; requests.get('https://douban.com');"

Reason

// wrong
self.session.headers['cookie'] = cookie

// right
requests.utils.add_dict_to_cookiejar(self.session.cookies, cookie)

// util
def getCookieDict(cookie_str):
    cookies = {}

    cookie = SimpleCookie()
    cookie.load(cookie_str)
    for key, morsel in cookie.items():
        cookies[key] = morsel.value
    return cookies