Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
version = property(get_version, set_version, None,
'Shopify Api Version')
def get_url(cls):
return getattr(cls._threadlocal, 'url', ShopifyResource._url)
def set_url(cls, value):
ShopifyResource._url = cls._threadlocal.url = value
url = property(get_url, set_url, None,
'Base URL including protocol and shopify domain')
@six.add_metaclass(ShopifyResourceMeta)
class ShopifyResource(ActiveResource, mixins.Countable):
_format = formats.JSONFormat
_threadlocal = threading.local()
_headers = {'User-Agent': 'ShopifyPythonAPI/%s Python/%s' % (shopify.VERSION, sys.version.split(' ', 1)[0])}
_version = None
_url = None
def __init__(self, attributes=None, prefix_options=None):
if attributes is not None and prefix_options is None:
prefix_options, attributes = self.__class__._split_options(attributes)
return super(ShopifyResource, self).__init__(attributes, prefix_options)
def is_new(self):
return not self.id
def _load_attributes_from_response(self, response):
if response.body.strip():
import pprint
from pyactiveresource.activeresource import ActiveResource
from pyactiveresource.connection import ResourceNotFound, MethodNotAllowed, ServerError
class RedmineResource(ActiveResource):
root_element = None
def __init__(self, attributes=None, prefix_options=None):
if isinstance(attributes, basestring):
self.name = attributes
super(RedmineResource, self).__init__(attributes, prefix_options)
def __repr__(self):
return pprint.pformat(self.attributes, indent=2, width=140)
@classmethod
def _build_list(cls, elements, prefix_options=None):
if cls.root_element is not None and \
isinstance(elements, dict) and cls.root_element in elements:
elements = elements[cls.root_element]
return super(RedmineResource, cls)._build_list(elements, prefix_options)
def get_record_class():
class Record(ActiveResource):
_site = API_URL % session[API_KEY]
return Record
import sys
import os
from pyactiveresource.activeresource import ActiveResource
from pyactiveresource.connection import ResourceNotFound, MethodNotAllowed
import urlparse
import pprint
class RedmineResource(ActiveResource):
def __init__(self, attributes=None, prefix_options=None):
if isinstance(attributes, basestring):
self.name = attributes
super(RedmineResource, self).__init__(attributes, prefix_options)
def __repr__(self):
return pprint.pformat(self.attributes, indent=2, width=140)
class Project(RedmineResource): pass
class Issue(RedmineResource): pass
class Group(RedmineResource): pass
class User(RedmineResource): pass
def get_zone_class():
class Zone(ActiveResource):
_site = API_URL % session[API_KEY]
return Zone