Skip to content

Instantly share code, notes, and snippets.

@abdilahrf
Created January 27, 2017 10:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abdilahrf/076d17f221780201f77a5cbc034c974d to your computer and use it in GitHub Desktop.
Save abdilahrf/076d17f221780201f77a5cbc034c974d to your computer and use it in GitHub Desktop.
import requests
from bs4 import BeautifulSoup
url = "https://felicity.iiit.ac.in/contest/extra/fastandfurious/"
soup = BeautifulSoup(requests.get(url).text,"lxml")
headers = {
'user-agent': "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36",
'content-type': "application/x-www-form-urlencoded",
'accept': "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
'referer': "https://felicity.iiit.ac.in/contest/extra/fastandfurious/",
'cookie': "birthday_invite=b326b5062b2f0e69046810717534cb09; PHPSESSID=ST-4009-E5zi3kCOXFQ769LpTOuF-felicityiiitacin; org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE=C; sessionid=sseb6lrgm0twg3sg5d1bjxiwfrtwfxzy;csrftoken=lHOpDIjhyLHtCBqeR0y307ADTZ1pxQoH; _ga=GA1.3.279779553.1484478699; __qbdcga=oiFlqcXU0c4%3D; __init__=GihQ240OiubNNz6IPLdiZA%3D%3D; __qaweb=n1zRbj66Y9U%3D",
}
print "Question :",soup.findAll('p')
while(True):
ans = 0
ans = eval(soup.findAll('p')[1].next.split(": ")[1].replace("(","",1).replace(")","",1))
datas = dict(ques_ans=ans)
print "Send : ",ans
res = requests.post(url,data=datas,headers=headers)
soup = BeautifulSoup(res.text,"lxml")
print "Question :",soup.findAll('p')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment