Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def refresh(self):
"""
Updates the information of the async job against the CARTO server.
After calling the :func:`refresh` method you should check the `state`
attribute of your resource
:return:
"""
if self.get_resource_endpoint() is None:
raise CartoException("Async job needs to be run or retrieved \
first!")
super(AsyncResource, self).refresh()
def refresh(self):
"""
Updates the information of the async job against the CARTO server.
After calling the :func:`refresh` method you should check the `state`
attribute of your resource
:return:
"""
if self.get_resource_endpoint() is None:
raise CartoException("Async job needs to be run or retrieved \
first!")
super(AsyncResource, self).refresh()
class WarnAsyncResource(AsyncResource):
"""
AsyncResource class for resources that represent non-public CARTO APIs.
You'll be warned not to used the in production environments
"""
def __init__(self, auth_client, **kwargs):
"""
Initializes the resource
:param auth_client: Client to make (non)authorized requests
:param kwargs: Initial value for attributes
:return:
"""
warnings.warn('This is part of a non-public CARTO API and may change in \
the future. Take this into account if you are using \
this in a production environment', FutureWarning)
super(WarnAsyncResource, self).__init__(auth_client, **kwargs)
"""
from pyrestcli.fields import IntegerField, CharField, BooleanField
from .exceptions import CartoException
from .resources import AsyncResource, Manager
from .paginators import CartoPaginator
API_VERSION = "v1"
API_ENDPOINT = 'api/{api_version}/imports/'
class FileImportJob(AsyncResource):
"""
This class provides support for one-time uploading and importing of
remote and local files into CARTO
"""
item_queue_id = CharField()
id = CharField()
user_id = CharField()
table_id = CharField()
data_type = CharField()
table_name = CharField()
state = CharField()
error_code = IntegerField()
queue_id = CharField()
tables_created_count = IntegerField()
synchronization_id = CharField()
type_guessing = BooleanField()
from urlparse import urljoin
from pyrestcli.fields import IntegerField, CharField, BooleanField, \
DateTimeField
from .exceptions import CartoException
from .resources import AsyncResource, Manager
from .paginators import CartoPaginator
API_VERSION = "v1"
API_ENDPOINT = 'api/{api_version}/synchronizations/'
API_FORCE_SYNC_SUFFIX = 'sync_now'
class SyncTableJob(AsyncResource):
"""
This class provides support for creating Sync Tables into CARTO
"""
id = CharField()
name = CharField()
interval = IntegerField()
url = CharField()
state = CharField()
created_at = DateTimeField()
updated_at = DateTimeField()
run_at = DateTimeField()
retried_times = IntegerField()
log_id = CharField()
error_code = IntegerField()
error_message = CharField()
ran_at = DateTimeField()
from pyrestcli.fields import IntegerField, CharField, BooleanField
from .resources import AsyncResource, Manager
from .paginators import CartoPaginator
API_VERSION = "v1"
API_ENDPOINT = '{api_version}/imports/'
class FileImportJob(AsyncResource):
"""
This class provides support for one-time uploading and importing of remote and local files into CARTO
"""
item_queue_id = CharField()
id = CharField()
user_id = CharField()
table_id = CharField()
data_type = CharField()
table_name = CharField()
state = CharField()
error_code = IntegerField()
queue_id = CharField()
tables_created_count = IntegerField()
synchronization_id = CharField()
type_guessing = BooleanField()
quoted_fields_guessing = BooleanField()