#!/Users/weisem1/bin/python2.7

# -*- coding: utf-8 -*-

import hashlib

import time

import requests

publicKey = 'XXXX'

ipAddress = 'XXX.XXX.XXX.XXX'

milliSeconds = str(int(round(time.time() * 1000)))

randomString = 'XXXXXXX'

privateKey = 'XXXXXXXXXXXXXXXXXXXXXXXXXXX'

m = hashlib.md5()

m.update(publicKey)

m.update(ipAddress)

m.update(milliSeconds)

m.update(randomString)

m.update(privateKey)

hexHash = str(m.hexdigest())

print('PublicKey: ' + publicKey)

print('ipAddress: ' + ipAddress)

print('Time: ' + milliSeconds)

print('RandomString: ' + randomString)

print('PrivateKey: ' + privateKey)

print('PreHash: ' + publicKey+ipAddress+milliSeconds+randomString+privateKey)

print('Hash: ' + hexHash)

url = 'https://hostname.collegiatelink.net/api/events';

paramVariables = {'apikey':publicKey,'ipaddress':ipAddress, 'time':milliSeconds, 'random':randomString, 'hash':hexHash}

r = requests.get(url, params=paramVariables)

print('URL: ' + r.url)

print('StatusCode: ' + str(r.status_code))

print(r.text)

Have more questions? Submit a request