##// END OF EJS Templates
urllibcompat: new library to help abstract out some python3 urllib2 stuff...
Augie Fackler -
r34466:80d46811 default
parent child Browse files
Show More
@@ -0,0 +1,42 b''
1 # urllibcompat.py - adapters to ease using urllib2 on Py2 and urllib on Py3
2 #
3 # Copyright 2017 Google, Inc.
4 #
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
7 from __future__ import absolute_import
8
9 from . import pycompat
10
11 if pycompat.ispy3:
12
13 def getfullurl(req):
14 return req.full_url
15
16 def gethost(req):
17 return req.host
18
19 def getselector(req):
20 return req.selector
21
22 def getdata(req):
23 return req.data
24
25 def hasdata(req):
26 return req.data is not None
27 else:
28
29 def gethost(req):
30 return req.get_host()
31
32 def getselector(req):
33 return req.get_selector()
34
35 def getfullurl(req):
36 return req.get_full_url()
37
38 def getdata(req):
39 return req.get_data()
40
41 def hasdata(req):
42 return req.has_data()
General Comments 0
You need to be logged in to leave comments. Login now