NamPNQ

Test hackerearth

Dec 12th, 2013
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. from google.appengine.api import urlfetch
  2. import urllib
  3. HACKEREARTH_CLIENT_SECRET = 'd07bff3fc29148e7243bf894e584904afafedcdd'
  4. HACKEREARTH_RUN_URL = 'http://api.hackerearth.com/code/run/'
  5. data = {
  6.     'source': """
  7. def cong(a,b):
  8.     return a+b
  9. print "Hello World"
  10. print "123"
  11. print cong(3,4)
  12.           """,
  13.     'lang': "PYTHON",
  14.     'time_limit': 5,
  15.     'memory_limit': 262144,}
  16. data.update({'client_secret': HACKEREARTH_CLIENT_SECRET})
  17. data.update({'async': 0})
  18. form_data = urllib.urlencode(data)
  19. result = urlfetch.fetch(url=HACKEREARTH_RUN_URL,
  20.                             payload=form_data,
  21.                             method=urlfetch.POST)
  22. print result.content
Add Comment
Please, Sign In to add comment