Search is not available for this dataset
text stringlengths 75 104k |
|---|
def serve(listen, verbosity=1, debug_port=0, **ssl_args):
"""Spawn greenlets for handling websockets and PostgreSQL calls."""
launcher = DDPLauncher(debug=verbosity == 3, verbosity=verbosity)
if debug_port:
launcher.servers.append(
launcher.get_backdoor_server('localhost:%d' % debug_port... |
def main():
"""Main entry point for `dddp` command."""
parser = argparse.ArgumentParser(description=__doc__)
django = parser.add_argument_group('Django Options')
django.add_argument(
'--verbosity', '-v', metavar='VERBOSITY', dest='verbosity', type=int,
default=1,
)
django.add_arg... |
def print(self, msg, *args, **kwargs):
"""Print formatted msg if verbosity set at 1 or above."""
if self.verbosity >= 1:
print(msg, *args, **kwargs) |
def add_web_servers(self, listen_addrs, debug=False, **ssl_args):
"""Add WebSocketServer for each (host, port) in listen_addrs."""
self.servers.extend(
self.get_web_server(listen_addr, debug=debug, **ssl_args)
for listen_addr in listen_addrs
) |
def get_web_server(self, listen_addr, debug=False, **ssl_args):
"""Setup WebSocketServer on listen_addr (host, port)."""
return geventwebsocket.WebSocketServer(
listen_addr,
self.resource,
debug=debug,
**{key: val for key, val in ssl_args.items() if val is... |
def get_backdoor_server(self, listen_addr, **context):
"""Add a backdoor (debug) server."""
from django.conf import settings
local_vars = {
'launcher': self,
'servers': self.servers,
'pgworker': self.pgworker,
'stop': self.stop,
'api': ... |
def stop(self):
"""Stop all green threads."""
self.logger.debug('PostgresGreenlet stop')
self._stop_event.set()
# ask all threads to stop.
for server in self.servers + [DDPLauncher.pgworker]:
self.logger.debug('Stopping %s', server)
server.stop()
#... |
def start(self):
"""Run PostgresGreenlet and web/debug servers."""
self.logger.debug('PostgresGreenlet start')
self._stop_event.clear()
self.print('=> Discovering DDP endpoints...')
if self.verbosity > 1:
for api_path in sorted(self.api.api_path_map()):
... |
def run(self):
"""Run DDP greenlets."""
self.logger.debug('PostgresGreenlet run')
self.start()
self._stop_event.wait()
# wait for all threads to stop.
gevent.joinall(self.threads + [DDPLauncher.pgworker])
self.threads = [] |
def ready(self):
"""Initialisation for django-ddp (setup lookups and signal handlers)."""
if not settings.DATABASES:
raise ImproperlyConfigured('No databases configured.')
for (alias, conf) in settings.DATABASES.items():
engine = conf['ENGINE']
if engine not i... |
def _run(self): # pylint: disable=method-hidden
"""Spawn sub tasks, wait for stop signal."""
conn_params = self.connection.get_connection_params()
# See http://initd.org/psycopg/docs/module.html#psycopg2.connect and
# http://www.postgresql.org/docs/current/static/libpq-connect.html
... |
def stop(self):
"""Stop subtasks and let run() finish."""
self._stop_event.set()
if self.select_greenlet is not None:
self.select_greenlet.kill()
self.select_greenlet.get()
gevent.sleep() |
def poll(self, conn):
"""Poll DB socket and process async tasks."""
while 1:
state = conn.poll()
if state == psycopg2.extensions.POLL_OK:
while conn.notifies:
notify = conn.notifies.pop()
self.logger.info(
... |
def greenify():
"""Patch threading and psycopg2 modules for green threads."""
# don't greenify twice.
if _GREEN:
return
_GREEN[True] = True
from gevent.monkey import patch_all, saved
if ('threading' in sys.modules) and ('threading' not in saved):
import warnings
warnings... |
def meteor_random_id(name=None, length=17):
"""Generate a new ID, optionally using namespace of given `name`."""
if name is None:
stream = THREAD_LOCAL.alea_random
else:
stream = THREAD_LOCAL.random_streams[name]
return stream.random_string(length, METEOR_ID_CHARS) |
def autodiscover():
"""Import all `ddp` submodules from `settings.INSTALLED_APPS`."""
from django.utils.module_loading import autodiscover_modules
from dddp.api import API
autodiscover_modules('ddp', register_to=API)
return API |
def as_dict(self, **kwargs):
"""Return an error dict for self.args and kwargs."""
error, reason, details, err_kwargs = self.args
result = {
key: val
for key, val in {
'error': error, 'reason': reason, 'details': details,
}.items()
i... |
def get(self, name, factory, *factory_args, **factory_kwargs):
"""Get attribute, creating if required using specified factory."""
update_thread_local = getattr(factory, 'update_thread_local', True)
if (not update_thread_local) or (name not in self.__dict__):
obj = factory(*factory_ar... |
def emit(self, record):
"""Emit a formatted log record via DDP."""
if getattr(this, 'subs', {}).get(LOGS_NAME, False):
self.format(record)
this.send({
'msg': ADDED,
'collection': LOGS_NAME,
'id': meteor_random_id('/collection/%s' % ... |
def select_renderer(request: web.Request, renderers: OrderedDict, force=True):
"""
Given a request, a list of renderers, and the ``force`` configuration
option, return a two-tuple of:
(media type, render callable). Uses mimeparse to find the best media
type match from the ACCEPT header.
"""
... |
def negotiation_middleware(
renderers=DEFAULTS['RENDERERS'],
negotiator=DEFAULTS['NEGOTIATOR'],
force_negotiation=DEFAULTS['FORCE_NEGOTIATION']
):
"""Middleware which selects a renderer for a given request then renders
a handler's data to a `aiohttp.web.Response`.
"""
@asyncio.coroutine
... |
def setup(
app: web.Application, *, negotiator: callable=DEFAULTS['NEGOTIATOR'],
renderers: OrderedDict=DEFAULTS['RENDERERS'],
force_negotiation: bool=DEFAULTS['FORCE_NEGOTIATION']
):
"""Set up the negotiation middleware. Reads configuration from
``app['AIOHTTP_UTILS']``.
:param app: Applicatio... |
def add_route_context(
app: web.Application, module=None, url_prefix: str=None, name_prefix: str=None
):
"""Context manager which yields a function for adding multiple routes from a given module.
Example:
.. code-block:: python
# myapp/articles/views.py
async def list_articles(request... |
def add_resource_context(
app: web.Application, module=None,
url_prefix: str=None, name_prefix: str=None, make_resource=lambda cls: cls()
):
"""Context manager which yields a function for adding multiple resources from a given module
to an app using `ResourceRouter <aiohttp_utils.routing.ResourceRouter>... |
def add_resource_object(self, path: str, resource, methods: tuple=tuple(), names: Mapping=None):
"""Add routes by an resource instance's methods.
:param path: route path. Should be started with slash (``'/'``).
:param resource: A "resource" instance. May be an instance of a plain object.
... |
def run(app: web.Application, **kwargs):
"""Run an `aiohttp.web.Application` using gunicorn.
:param app: The app to run.
:param str app_uri: Import path to `app`. Takes the form
``$(MODULE_NAME):$(VARIABLE_NAME)``.
The module name can be a full dotted path.
The variable name refers ... |
def send_message(self, message, **kwargs):
"""
Sends a push notification to this device via GCM
"""
from ..libs.gcm import gcm_send_message
data = kwargs.pop("extra", {})
if message is not None:
data["message"] = message
return gcm_send_message(regis... |
def apns_send_bulk_message(registration_ids, alert, **kwargs):
"""
Sends an APNS notification to one or more registration_ids.
The registration_ids argument needs to be a list.
Note that if set alert should always be a string. If it is not set,
it won't be included in the notification. You will nee... |
def apns_fetch_inactive_ids():
"""
Queries the APNS server for id's that are no longer active since
the last fetch
"""
with closing(_apns_create_socket_to_feedback()) as socket:
inactive_ids = []
for _, registration_id in _apns_receive_feedback(socket):
inactive_ids.appe... |
def gcm_send_message(registration_id, data, encoding='utf-8', **kwargs):
"""
Standalone method to send a single gcm notification
"""
messenger = GCMMessenger(registration_id, data, encoding=encoding, **kwargs)
return messenger.send_plain() |
def gcm_send_bulk_message(registration_ids, data, encoding='utf-8', **kwargs):
"""
Standalone method to send bulk gcm notifications
"""
messenger = GCMMessenger(registration_ids, data, encoding=encoding, **kwargs)
return messenger.send_bulk() |
def send_plain(self):
"""
Sends a text/plain GCM message
"""
values = {"registration_id": self._registration_id}
for key, val in self._data.items():
values["data.%s" % (key)] = val.encode(self.encoding)
for key, val in self._kwargs.items():
if v... |
def send_json(self, ids=None):
"""
Sends a json GCM message
"""
items = ids or self._registration_id
values = {"registration_ids": items}
if self._data is not None:
values["data"] = self._data
for key, val in self._kwargs.items():
if val... |
def _send(self, data, content_type):
"""
Sends a GCM message with the given content type
"""
headers = {
"Content-Type": content_type,
"Authorization": "key=%s" % (self.api_key),
"Content-Length": str(len(data))
}
request = Request(se... |
def get_model(module_location):
"""
Returns the instance of the given module location.
"""
if not isinstance(module_location, (str, unicode)):
raise ValueError("The value provided should either be a string or "\
"unicode instance. The value '%s' provided was %s "\
... |
def plot_line_power(obj, results, hour, ax=None):
'''
obj: case or network
'''
if ax is None:
fig, ax = plt.subplots(1, 1, figsize=(16, 10))
ax.axis('off')
case, network = _return_case_network(obj)
network.draw_buses(ax=ax)
network.draw_loads(ax=ax)
network.draw_genera... |
def fast_forward_selection(scenarios, number_of_reduced_scenarios, probability=None):
"""Fast forward selection algorithm
Parameters
----------
scenarios : numpy.array
Contain the input scenarios.
The columns representing the individual scenarios
The rows are the vector of value... |
def simultaneous_backward_reduction(scenarios, number_of_reduced_scenarios, probability=None):
"""Simultaneous backward reduction algorithm
Parameters
----------
scenarios : numpy.array
Contain the input scenarios.
The columns representing the individual scenarios
The rows are t... |
def search(term=None, phrase=None, limit=DEFAULT_SEARCH_LIMIT,
api_key=GIPHY_PUBLIC_KEY, strict=False, rating=None):
"""
Shorthand for creating a Giphy api wrapper with the given api key
and then calling the search method. Note that this will return a generator
"""
return Giphy(api_key=ap... |
def translate(term=None, phrase=None, api_key=GIPHY_PUBLIC_KEY, strict=False,
rating=None):
"""
Shorthand for creating a Giphy api wrapper with the given api key
and then calling the translate method.
"""
return Giphy(api_key=api_key, strict=strict).translate(
term=term, phrase... |
def trending(limit=DEFAULT_SEARCH_LIMIT, api_key=GIPHY_PUBLIC_KEY,
strict=False, rating=None):
"""
Shorthand for creating a Giphy api wrapper with the given api key
and then calling the trending method. Note that this will return
a generator
"""
return Giphy(api_key=api_key, strict=... |
def gif(gif_id, api_key=GIPHY_PUBLIC_KEY, strict=False):
"""
Shorthand for creating a Giphy api wrapper with the given api key
and then calling the gif method.
"""
return Giphy(api_key=api_key, strict=strict).gif(gif_id) |
def screensaver(tag=None, api_key=GIPHY_PUBLIC_KEY, strict=False):
"""
Shorthand for creating a Giphy api wrapper with the given api key
and then calling the screensaver method.
"""
return Giphy(api_key=api_key, strict=strict).screensaver(tag=tag) |
def upload(tags, file_path, username=None, api_key=GIPHY_PUBLIC_KEY,
strict=False):
"""
Shorthand for creating a Giphy api wrapper with the given api key
and then calling the upload method.
"""
return Giphy(api_key=api_key, strict=strict).upload(
tags, file_path, username) |
def _make_images(self, images):
"""
Takes an image dict from the giphy api and converts it to attributes.
Any fields expected to be int (width, height, size, frames) will be attempted
to be converted. Also, the keys of `data` serve as the attribute names, but
with special action ... |
def _normalized(self, data):
"""
Does a normalization of sorts on image type data so that values
that should be integers are converted from strings
"""
int_keys = ('frames', 'width', 'height', 'size')
for key in int_keys:
if key not in data:
c... |
def _fetch(self, endpoint_name, **params):
"""
Wrapper for making an api request from giphy
"""
params['api_key'] = self.api_key
resp = requests.get(self._endpoint(endpoint_name), params=params)
resp.raise_for_status()
data = resp.json()
self._check_or_r... |
def search(self, term=None, phrase=None, limit=DEFAULT_SEARCH_LIMIT,
rating=None):
"""
Search for gifs with a given word or phrase. Punctuation is ignored.
By default, this will perform a `term` search. If you want to search
by phrase, use the `phrase` keyword argument. Wh... |
def search_list(self, term=None, phrase=None, limit=DEFAULT_SEARCH_LIMIT,
rating=None):
"""
Suppose you expect the `search` method to just give you a list rather
than a generator. This method will have that effect. Equivalent to::
>>> g = Giphy()
>>> ... |
def translate(self, term=None, phrase=None, strict=False, rating=None):
"""
Retrieve a single image that represents a transalation of a term or
phrase into an animated gif. Punctuation is ignored. By default, this
will perform a `term` translation. If you want to translate by phrase,
... |
def trending(self, rating=None, limit=DEFAULT_SEARCH_LIMIT):
"""
Retrieve GIFs currently trending online. The data returned mirrors
that used to create The Hot 100 list of GIFs on Giphy.
:param rating: limit results to those rated (y,g, pg, pg-13 or r).
:type rating: string
... |
def trending_list(self, rating=None, limit=DEFAULT_SEARCH_LIMIT):
"""
Suppose you expect the `trending` method to just give you a list rather
than a generator. This method will have that effect. Equivalent to::
>>> g = Giphy()
>>> results = list(g.trending())
"""... |
def gif(self, gif_id, strict=False):
"""
Retrieves a specifc gif from giphy based on unique id
:param gif_id: Unique giphy gif ID
:type gif_id: string
:param strict: Whether an exception should be raised when no results
:type strict: boolean
"""
resp = se... |
def screensaver(self, tag=None, strict=False):
"""
Returns a random giphy image, optionally based on a search of a given tag.
Note that this method will both query for a screensaver image and fetch the
full details of that image (2 request calls)
:param tag: Tag to retrieve a sc... |
def upload(self, tags, file_path, username=None):
"""
Uploads a gif from the filesystem to Giphy.
:param tags: Tags to apply to the uploaded image
:type tags: list
:param file_path: Path at which the image can be found
:type file_path: string
:param username: You... |
def _convert(self, args):
'''convert '(1,1)' to 'B2' and 'B2' to '(1,1)' auto-recongnize'''
if args.find(",") > -1:
b, a = args.replace("(", "").replace(")", "").split(",")
a = chr(int(a)+65)#chr(65) is "A" and ord("A") is 65
b = str(int(b)+1)
return a+b
... |
def _access_control(self, access_control, my_media_group=None):
"""
Prepares the extension element for access control
Extension element is the optional parameter for the YouTubeVideoEntry
We use extension element to modify access control settings
Returns:
tuple of ex... |
def fetch_feed_by_username(self, username):
"""
Retrieve the video feed by username
Returns:
gdata.youtube.YouTubeVideoFeed object
"""
# Don't use trailing slash
youtube_url = 'http://gdata.youtube.com/feeds/api'
uri = os.sep.join([youtube_url, "users", us... |
def authenticate(self, email=None, password=None, source=None):
"""
Authenticates the user and sets the GData Auth token.
All params are optional, if not set, we will use the ones on the settings, if no settings found, raises AttributeError
params are email, password and source. Source i... |
def upload_direct(self, video_path, title, description="", keywords="", developer_tags=None, access_control=AccessControl.Public):
"""
Direct upload method:
Uploads the video directly from your server to Youtube and creates a video
Returns:
gdata.youtube.YouTubeVideoEntr... |
def upload(self, title, description="", keywords="", developer_tags=None, access_control=AccessControl.Public):
"""
Browser based upload
Creates the video entry and meta data to initiate a browser upload
Authentication is needed
Params:
title: string
des... |
def check_upload_status(self, video_id):
"""
Checks the video upload status
Newly uploaded videos may be in the processing state
Authentication is required
Returns:
True if video is available
otherwise a dict containes upload_state and detailed message
... |
def update_video(self, video_id, title="", description="", keywords="", access_control=AccessControl.Unlisted):
"""
Updates the video
Authentication is required
Params:
entry: video entry fetch via 'fetch_video()'
title: string
description: string
... |
def delete_video(self, video_id):
"""
Deletes the video
Authentication is required
Params:
entry: video entry fetch via 'fetch_video()'
Return:
True if successful
Raise:
OperationError: on unsuccessful deletion
"""
#... |
def check_video_availability(request, video_id):
"""
Controls the availability of the video. Newly uploaded videos are in processing stage.
And others might be rejected.
Returns:
json response
"""
# Check video availability
# Available states are: processing
api = Api()
api.... |
def video(request, video_id):
"""
Displays a video in an embed player
"""
# Check video availability
# Available states are: processing
api = Api()
api.authenticate()
availability = api.check_upload_status(video_id)
if availability is not True:
# Video is not available
... |
def video_list(request, username=None):
"""
list of videos of a user
if username does not set, shows the currently logged in user
"""
# If user is not authenticated and username is None, raise an error
if username is None and not request.user.is_authenticated():
from django.http import ... |
def direct_upload(request):
"""
direct upload method
starts with uploading video to our server
then sends the video file to youtube
param:
(optional) `only_data`: if set, a json response is returns i.e. {'video_id':'124weg'}
return:
if `only_data` set, a json object.
ot... |
def upload(request):
"""
Displays an upload form
Creates upload url and token from youtube api and uses them on the form
"""
# Get the optional parameters
title = request.GET.get("title", "%s's video on %s" % (
request.user.username, request.get_host()))
description = request.GET.get... |
def upload_return(request):
"""
The upload result page
Youtube will redirect to this page after upload is finished
Saves the video data and redirects to the next page
Params:
status: status of the upload (200 for success)
id: id number of the video
"""
status = request.GET.g... |
def remove(request, video_id):
"""
Removes the video from youtube and from db
Requires POST
"""
# prepare redirection url
try:
next_url = settings.YOUTUBE_DELETE_REDIRECT_URL
except AttributeError:
next_url = reverse("django_youtube.views.upload")
# Remove from db
t... |
def entry(self):
"""
Connects to Youtube Api and retrieves the video entry object
Return:
gdata.youtube.YouTubeVideoEntry
"""
api = Api()
api.authenticate()
return api.fetch_video(self.video_id) |
def save(self, *args, **kwargs):
"""
Syncronize the video information on db with the video on Youtube
The reason that I didn't use signals is to avoid saving the video instance twice.
"""
# if this is a new instance add details from api
if not self.id:
# Conn... |
def delete(self, *args, **kwargs):
"""
Deletes the video from youtube
Raises:
OperationError
"""
api = Api()
# Authentication is required for deletion
api.authenticate()
# Send API request, raises OperationError on unsuccessful deletion
... |
def regenerate(self):
""" Method for `Regenerate Key <https://m2x.att.com/developer/documentation/v2/keys#Regenerate-Key>`_ endpoint.
:raises: :class:`~requests.exceptions.HTTPError` if an error occurs when sending the HTTP request
"""
self.data.update(
self.api.post(self.it... |
def devices(self, **params):
""" Method for `List Devices from an existing Distribution <https://m2x.att.com/developer/documentation/v2/distribution#List-Devices-from-an-existing-Distribution>`_ endpoint.
:param params: Query parameters passed as keyword arguments. View M2X API Docs for listing of avai... |
def add_device(self, params):
""" Method for `Add Device to an Existing Distribution <https://m2x.att.com/developer/documentation/v2/distribution#Add-Device-to-an-existing-Distribution>`_ endpoint.
:param params: Query parameters passed as keyword arguments. View M2X API Docs for listing of available p... |
def devices(self, **params):
""" Method for `List Devices from an existing Collection <https://m2x.att.com/developer/documentation/v2/collections#List-Devices-from-an-existing-Collection>`_ endpoint.
:param params: Query parameters passed as keyword arguments. View M2X API Docs for listing of available... |
def add_device(self, device_id):
""" Method for `Add device to collection <https://m2x.att.com/developer/documentation/v2/collections#Add-device-to-collection>`_ endpoint.
:param device_id: ID of the Device being added to Collection
:type device_id: str
:raises: :class:`~requests.excep... |
def remove_device(self, device_id):
""" Method for `Remove device from collection <https://m2x.att.com/developer/documentation/v2/collections#Remove-device-from-collection>`_ endpoint.
:param device_id: ID of the Device being removed from Collection
:type device_id: str
:raises: :class... |
def create_stream(self, name, **params):
""" Method for `Create/Update Data Stream <https://m2x.att.com/developer/documentation/v2/device#Create-Update-Data-Stream>`_ endpoint.
:param name: Name of the stream to be created
:param params: Query parameters passed as keyword arguments. View M2X AP... |
def update_stream(self, name, **params):
""" Method for `Create/Update Data Stream <https://m2x.att.com/developer/documentation/v2/device#Create-Update-Data-Stream>`_ endpoint.
:param name: Name of the stream to be updated
:param params: Query parameters passed as keyword arguments. View M2X AP... |
def create_key(self, **params):
""" Create an API Key for this Device via the `Create Key <https://m2x.att.com/developer/documentation/v2/keys#Create-Key>`_ endpoint.
:param params: Query parameters passed as keyword arguments. View M2X API Docs for listing of available parameters.
:return: Th... |
def location(self):
""" Method for `Read Device Location <https://m2x.att.com/developer/documentation/v2/device#Read-Device-Location>`_ endpoint.
:return: Most recently logged location of the Device, see M2X API docs for details
:rtype: dict
:raises: :class:`~requests.exceptions.HTTPEr... |
def location_history(self, **params):
""" Method for `Read Device Location History <https://m2x.att.com/developer/documentation/v2/device#Read-Device-Location-History>`_ endpoint.
:param params: Query parameters passed as keyword arguments. View M2X API Docs for listing of available parameters.
... |
def update_location(self, **params):
""" Method for `Update Device Location <https://m2x.att.com/developer/documentation/v2/device#Update-Device-Location>`_ endpoint.
:param params: Query parameters passed as keyword arguments. View M2X API Docs for listing of available parameters.
:return: Th... |
def post_updates(self, **values):
""" Method for `Post Device Updates (Multiple Values to Multiple Streams) <https://m2x.att.com/developer/documentation/v2/device#Post-Device-Updates--Multiple-Values-to-Multiple-Streams->`_ endpoint.
:param values: The values being posted, formatted according to the AP... |
def post_update(self, **values):
""" Method for `Post Device Update (Single Values to Multiple Streams) <https://m2x.att.com/developer/documentation/v2/device#Post-Device-Update--Single-Values-to-Multiple-Streams->` endpoint.
:param values: The values being posted, formatted according to the API docs
... |
def values(self, **params):
""" Method for `List Data Stream Values <https://m2x.att.com/developer/documentation/v2/device#List-Data-Stream-Values>`_ endpoint.
:param params: Query parameters passed as keyword arguments. View M2X API Docs for listing of available parameters.
:return: The API r... |
def values_export(self, **params):
""" Method for `Export Values from all Data Streams of a Device <https://m2x.att.com/developer/documentation/v2/device#Export-Values-from-all-Data-Streams-of-a-Device>`_ endpoint.
:param params: Query parameters passed as keyword arguments. View M2X API Docs for listi... |
def values_search(self, **params):
""" Method for `Search Values from all Data Streams of a Device <https://m2x.att.com/developer/documentation/v2/device#Search-Values-from-all-Data-Streams-of-a-Device>`_ endpoint.
:param params: Query parameters passed as keyword arguments. View M2X API Docs for listi... |
def commands(self, **params):
""" Method for `Device's List of Received Commands <https://m2x.att.com/developer/documentation/v2/commands#Device-s-List-of-Received-Commands>`_ endpoint.
:param params: Query parameters passed as keyword arguments. View M2X API Docs for listing of available parameters.
... |
def process_command(self, id, **params):
""" Method for `Device Marks a Command as Processed <https://m2x.att.com/developer/documentation/v2/commands#Device-Marks-a-Command-as-Processed>`_ endpoint.
:param id: ID of the Command being marked as processed
:param params: Optional data to be associ... |
def reject_command(self, id, **params):
""" Method for `Device Marks a Command as Rejected <https://m2x.att.com/developer/documentation/v2/commands#Device-Marks-a-Command-as-Rejected>`_ endpoint.
:param id: ID of the Command being marked as rejected
:param params: Optional data to be associated... |
def update_metadata(self, params):
""" Generic method for a resource's Update Metadata endpoint.
Example endpoints:
* `Update Device Metadata <https://m2x.att.com/developer/documentation/v2/device#Update-Device-Metadata>`_
* `Update Distribution Metadata <https://m2x.att.com/developer/documentation/v2... |
def update_metadata_field(self, field, value):
""" Generic method for a resource's Update Metadata Field endpoint.
Example endpoints:
* `Update Device Metadata Field <https://m2x.att.com/developer/documentation/v2/device#Update-Device-Metadata-Field>`_
* `Update Distribution Metadata Field <https://m2... |
def update(self, **attrs):
""" Generic method for a resource's Update endpoint.
Example endpoints:
* `Update Device Details <https://m2x.att.com/developer/documentation/v2/device#Update-Device-Details>`_
* `Update Distribution Details <https://m2x.att.com/developer/documentation/v2/dis... |
def update(self, **attrs):
""" Method for `Update Data Stream <https://m2x.att.com/developer/documentation/v2/device#Create-Update-Data-Stream>`_ endpoint.
:param attrs: Query parameters passed as keyword arguments. View M2X API Docs for listing of available parameters.
:return: The Stream bei... |
def sampling(self, interval, **params):
""" Method for `Data Stream Sampling <https://m2x.att.com/developer/documentation/v2/device#Data-Stream-Sampling>`_ endpoint.
:param interval: the sampling interval, see API docs for supported interval types
:param params: Query parameters passed as keywo... |
def stats(self, **attrs):
""" Method for `Data Stream Stats <https://m2x.att.com/developer/documentation/v2/device#Data-Stream-Stats>`_ endpoint.
:param attrs: Query parameters passed as keyword arguments. View M2X API Docs for listing of available parameters.
:return: The API response, see M2... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.