Skip to content

Instantly share code, notes, and snippets.

@barberj
Created August 29, 2012 14:12
Show Gist options
  • Save barberj/3513161 to your computer and use it in GitHub Desktop.
Save barberj/3513161 to your computer and use it in GitHub Desktop.
Requests issue
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()
@barberj
Copy link
Author

barberj commented Aug 29, 2012

Results of running are:

$ python commute.py
Justin not in response
Justin in response
Justin not in response
Justin not in response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment