I have not really dug in deep into django and signatures
I am trying to create a signature based on a given requirements
i = my username, v = expiration, and s = signature
i: MYUSERNAME
v: UNIX TIMESTAMP + 2 hours
a: MY_API_KEY
s: SHA1 SIGNATURE that is ("i=MYUSERNAME&v=(UNIX_TIMESTAMP + API_KEY)")
What I have so far.
import hashlib
import datetime
from datetime import timedelta
import time
now = datetime.datetime.now()
now = now + timedelta(hours=2)
seconds = time.mktime(now.timetuple())
seconds = seconds
API = "87df234207v4444444"
signature = hashlib.sha1()
signature.update("i=MYUSERNAME&v=%s%s" % (seconds, API))
Then when I ping the url, I get a "Bad Signature" response
Again my knowledge in this area is limited, your help is much appreciated
and the valid iframe to get the correct code is http://api.myurl.com/i=MYUSERNAME&v=UNIX TIMESTAMP + 2 HOURS&s=MY VALID SIGNATURE
PDF Documentation
Imagine that we need to calculate the signature for the following URI:
http://framed.incloode.com/index.php?i=TEST&arg1=val1&arg2=val2&t=123
The method to calculate the signature is as follows:
The only thing I can see from your description is that you are not grabbing the hex digest at the end, which I can only assume is what the server expects. Send this value instead:
hashed = signature.hexdigest()
Otherwise please post the documentation for this web service and make sure you are honoring case requirements (you never know...)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.