Skip to content

Commit

Permalink
fix #231 change signature() encoding method to quote() to meet docs o…
Browse files Browse the repository at this point in the history
…f alidns (#238)

* should use quote() to encode space to %20 according to the docs

* quote() after urlencode() not need exclude '/' safe
  • Loading branch information
CrazyBoyFeng committed Mar 24, 2021
1 parent 62eed8b commit 56df5f6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dns/alidns.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ def signature(params):
'SignatureNonce': uuid4(),
'SignatureVersion': "1.0",
})
query = urlencode(sorted(params.items()))
query = urlencode(sorted(params.items()), quote_via=quote)
debug(query)
sign = API.METHOD + "&" + quote_plus("/") + "&" + quote(query, safe='')
sign = API.METHOD + "&" + quote_plus("/") + "&" + quote(query)
debug("signString: %s", sign)

sign = hmac((Config.TOKEN + "&").encode('utf-8'),
Expand Down

0 comments on commit 56df5f6

Please sign in to comment.