summaryrefslogtreecommitdiff
path: root/genericrequest.py
diff options
context:
space:
mode:
Diffstat (limited to 'genericrequest.py')
-rwxr-xr-xgenericrequest.py32
1 files changed, 0 insertions, 32 deletions
diff --git a/genericrequest.py b/genericrequest.py
deleted file mode 100755
index bea5d67..0000000
--- a/genericrequest.py
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/python
-
-import urllib
-import urllib2
-import simplejson
-import sys
-urlencode = urllib.urlencode
-urlopen = urllib2.urlopen
-Request = urllib2.Request
-
-def request (url, data):
- headers = {
- 'User-Agent': 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)',
- 'Accept': '*/*'
- }
- try:
- data = urlencode(data)
- req = Request(url, data, headers)
- response = urlopen(req)
- try:
- thejson = response.read()
- response = simplejson.loads(thejson)
- except ValueError:
- response = response.read()
- return response
- except IOError, e:
- if hasattr(e, 'code'):
- print '%s - ERROR %s' % (self.url, e.code)
- return None
- else:
- return response
-