Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
class RevokeTokenParams(Model):
class Options:
serialize_when_none = False
client_id = StringType(default=lambda: config.OAUTH2_CLIENT_ID, required=True)
client_secret = StringType(default=lambda: config.OAUTH2_CLIENT_SECRET, required=True)
token = StringType(required=True)
token_type_hint = StringType(choices=('access_token', 'refresh_token'), default='access_token', required=True)
class AccessToken(Model):
access_token = StringType()
token_type = StringType()
scope = StringListType(StringType, separator=" ")
refresh_token = StringType(serialize_when_none=False)
expires_in = IntType(serialize_when_none=False)
country = ListType(StringType)
location_around = ModelType(LocationAround)
within = StringListType(StringModelType(Area), separator="+")
place = ModelType(Place)
relevance = ListType(StringType)
brand_unsafe = ModelType(BrandUnsafe)
entity = ModelType(Entity)
class Entities(Model):
class Options:
serialize_when_none = True
entity_id = StringType()
name = StringType()
type = StringType()
formatted_address = StringType()
class Event(Model):
class Options:
serialize_when_none = True
id = StringType()
title = StringType()
description = StringType()
start = DateTimeType()
end = DateTimeType()
timezone = StringType()
class RevokeTokenParams(Model):
class Options:
serialize_when_none = False
client_id = StringType(default=lambda: config.OAUTH2_CLIENT_ID, required=True)
client_secret = StringType(default=lambda: config.OAUTH2_CLIENT_SECRET, required=True)
token = StringType(required=True)
token_type_hint = StringType(choices=('access_token', 'refresh_token'), default='access_token', required=True)
class AccessToken(Model):
access_token = StringType()
token_type = StringType()
scope = StringListType(StringType, separator=" ")
refresh_token = StringType(serialize_when_none=False)
expires_in = IntType(serialize_when_none=False)
formatted_address = StringType()
class Event(Model):
class Options:
serialize_when_none = True
id = StringType()
title = StringType()
description = StringType()
start = DateTimeType()
end = DateTimeType()
timezone = StringType()
duration = IntType()
category = StringType()
labels = ListType(StringType())
country = StringType()
rank = IntType()
# `local_rank`, `aviation_rank`, and `phq_attendance` are paid features.
# They will only show up in your response body if you
# have subscribed to them.
local_rank = IntType()
aviation_rank = IntType()
phq_attendance = IntType()
entities = ListType(ModelType(Entities))
location = GeoJSONPointType()
place_hierarchies = ListType(ListType(StringType()))
scope = StringType()
relevance = FloatType()
class SignalID(Model):
id = StringType(required=True)
class Signal(Model):
class Options:
serialize_when_none = True
roles = {
"create": whitelist("name", "country", "dimensions"),
"update": blacklist("created_at", "updated_at")
}
id = StringType()
name = StringType(required=True)
country = StringType(max_length=2, min_length=2, required=True)
dimensions = ListType(ModelType(Dimension), default=[])
created_at = DateTimeType()
updated_at = DateTimeType()
def add_dimension(self, dimension_name, dimension_type):
self.dimensions.append(Dimension({"name": dimension_name, "type": dimension_type}))
def remove_dimension(self, dimension_name):
self.dimensions = [dimension for dimension in self.dimensions if dimension.name != dimension_name]
def save(self, endpoint=None):
if endpoint is not None:
self._endpoint = endpoint
if self.id:
return self._endpoint.update(self)
from predicthq.endpoints.schemas import Model, StringType, DateTimeType, ModelType
class Industry(Model):
id = StringType()
name = StringType()
class Account(Model):
id = StringType()
name = StringType()
description = StringType()
industry = ModelType(Industry)
created_at = DateTimeType()
updated_at = DateTimeType()
class Event(Model):
class Options:
serialize_when_none = True
id = StringType()
title = StringType()
description = StringType()
start = DateTimeType()
end = DateTimeType()
timezone = StringType()
duration = IntType()
category = StringType()
labels = ListType(StringType())
country = StringType()
rank = IntType()
# `local_rank`, `aviation_rank`, and `phq_attendance` are paid features.
# They will only show up in your response body if you
# have subscribed to them.
local_rank = IntType()
aviation_rank = IntType()
phq_attendance = IntType()
entities = ListType(ModelType(Entities))
location = GeoJSONPointType()
place_hierarchies = ListType(ListType(StringType()))
scope = StringType()
relevance = FloatType()
state = StringType()
from predicthq.endpoints.schemas import Model, StringType, DateTimeType, ModelType
class Industry(Model):
id = StringType()
name = StringType()
class Account(Model):
id = StringType()
name = StringType()
description = StringType()
industry = ModelType(Industry)
created_at = DateTimeType()
updated_at = DateTimeType()
class Options:
serialize_when_none = False
id = ListType(StringType)
q = StringType()
label = ListType(StringType)
category = ListType(StringType)
start = ModelType(DateTimeRange)
start_around = ModelType(DateAround)
end = ModelType(DateTimeRange)
end_around = ModelType(DateAround)
active = ModelType(DateTimeRange)
updated = ModelType(DateTimeRange)
state = StringType(choices=('active', 'deleted'))
deleted_reason = StringType(choices=('cancelled', 'duplicate', 'invalid', 'postponed'))
rank = ModelType(IntRange)
rank_level = ListType(IntType(min_value=1, max_value=5))
# `local_rank`, `aviation_rank`, and `phq_attendance` are paid features.
# If you haven't subscribed to a paid feature, using it as a
# search param will have no effect on your search results.
local_rank = ModelType(IntRange)
local_rank_level = ListType(IntType(min_value=1, max_value=5))
aviation_rank = ModelType(IntRange)
aviation_rank_level = ListType(IntType(min_value=1, max_value=5))
phq_attendance = ModelType(IntRange)
country = ListType(StringType)
location_around = ModelType(LocationAround)
within = StringListType(StringModelType(Area), separator="+")
place = ModelType(Place)