dont break ox.API subclasses
This commit is contained in:
parent
714729fee7
commit
828223ad82
1 changed files with 88 additions and 85 deletions
15
ox/api.py
15
ox/api.py
|
@ -8,14 +8,19 @@ import gzip
|
||||||
import StringIO
|
import StringIO
|
||||||
import urllib2
|
import urllib2
|
||||||
|
|
||||||
|
from . import __version__
|
||||||
from .utils import json
|
from .utils import json
|
||||||
from .form import MultiPartForm
|
from .form import MultiPartForm
|
||||||
|
|
||||||
__all__ = ['API']
|
__all__ = ['getAPI', 'API']
|
||||||
|
|
||||||
def API(url, cj=None):
|
def getAPI(url, cj=None):
|
||||||
class API(object):
|
class A(API):
|
||||||
__version__ = 0.0
|
pass
|
||||||
|
return A(url, cj)
|
||||||
|
|
||||||
|
class API(object):
|
||||||
|
__version__ = __version__
|
||||||
__name__ = 'ox'
|
__name__ = 'ox'
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
debuglevel = 0
|
debuglevel = 0
|
||||||
|
@ -105,5 +110,3 @@ def API(url, cj=None):
|
||||||
form.add_field('data', json.dumps(data))
|
form.add_field('data', json.dumps(data))
|
||||||
return self._json_request(self.url, form)
|
return self._json_request(self.url, form)
|
||||||
|
|
||||||
return API(url, cj)
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue