Skip to content

Instantly share code, notes, and snippets.

@yegle

yegle/opt.py

Created Jul 3, 2014
Embed
What would you like to do?
USCIS OPT application status query
#!/usr/bin/env python
# vim: set fileencoding=utf-8 ts=4 sw=4 tw=79 :
from __future__ import (unicode_literals, absolute_import,
division, print_function)
import requests
from lxml import etree
from io import StringIO
payload = {
'appReceiptNum': 'SRC1490207645',
}
if __name__ == '__main__':
s = requests.session()
s.get('https://egov.uscis.gov/cris/Dashboard/CaseStatus.do', verify=False)
ret = s.post('https://egov.uscis.gov/cris/Dashboard/CaseStatus.do',
data=payload, verify=False)
tree = etree.parse(StringIO(ret.text), etree.HTMLParser())
n = tree.xpath("//div[@id='caseStatus']"
"/div[@class='controls']"
"/h4/br")
status = n[0].tail.strip()
if status != 'Initial Review':
print(status)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.