예제 #1
0
 def __request_get(self, url):
     req = urllib2.Request(url)
     try:
         result = urllib2.urlopen(req).read()
         result = json.loads(result)
         return result
     except Exception, e:
         warn('get fails')
         return None
예제 #2
0
파일: online.py 프로젝트: lujinda/cheat
 def __request_get(self, url):
     req = urllib2.Request(url)
     try:
         result = urllib2.urlopen(req).read()
         result = json.loads(result)
         return result
     except Exception, e:
         warn('get fails')
         return None
예제 #3
0
 def __request_post(self, url, post_data):
     req = urllib2.Request(url, urllib.urlencode(post_data))
     try:
         result = urllib2.urlopen(req).read()
         result = json.loads(result)
         code = int(result['code'])
         if code % 2 == 1 and code >= 500:
             die(result['mess'])
         return result
     except Exception, e:
         warn('modify fails')
         return None
예제 #4
0
파일: online.py 프로젝트: lujinda/cheat
 def __request_post(self, url, post_data):
     req = urllib2.Request(url, urllib.urlencode(post_data))
     try:
         result = urllib2.urlopen(req).read()
         result = json.loads(result)
         code = int(result['code'])
         if code % 2 == 1 and code >= 500:
             die(result['mess'])
         return result 
     except Exception, e:
         warn('modify fails')
         return None