示例#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