Skip to content

Instantly share code, notes, and snippets.

@davidyen1124 davidyen1124/

Created Feb 18, 2014
What would you like to do?
import requests
import re
url = ""
def main():
session = requests.session()
response = session.get(url)
content = response.content
if content:
payload = {'__EVENTTARGET': 'lbtnDown01',
'selMarket': 1,
'__EVENTVALIDATION': get_hidden_value('__EVENTVALIDATION', content),
'__VIEWSTATE': get_hidden_value('__VIEWSTATE', content)}
response =, payload)
content = response.content
if content:
with open("kgi.xls", "wb") as f:
def get_hidden_value(id, content):
value = ''
match ='id="%s" value="(.*?)"' % (id), content)
if match:
value =
return value
if __name__ == '__main__':
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.