Created
August 29, 2012 14:12
-
-
Save barberj/3513161 to your computer and use it in GitHub Desktop.
Requests issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
def log(): | |
url = 'https://www.logyourcommute.org/cac/accesscontrol.action' | |
data={'idUser': REDACTED, | |
'idPassword': REDACTED, | |
'action': 'login', | |
'idActivation': 'null', | |
'Submit': 'Log On >>'} | |
timeout=float(600) | |
with requests.session() as s: | |
rsp = s.post(url, data=data, timeout=timeout) | |
print('Justin {}in response'.format('' if'JUSTIN D BARBER' in rsp.content else 'not ')) | |
rsp = s.request('post', url, data=data, timeout=timeout) | |
print('Justin {}in response'.format('' if'JUSTIN D BARBER' in rsp.content else 'not ')) | |
rsp = requests.post(url, data=data, timeout=timeout) | |
print('Justin {}in response'.format('' if'JUSTIN D BARBER' in rsp.content else 'not ')) | |
rsp = requests.request('post', url, data=data, timeout=timeout) | |
print('Justin {}in response'.format('' if'JUSTIN D BARBER' in rsp.content else 'not ')) | |
if __name__ == '__main__': | |
log() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Results of running are:
$ python commute.py
Justin not in response
Justin in response
Justin not in response
Justin not in response