code
stringlengths
1
18.2k
or equivalent token given to an app when registering with a push notification provider. Only valid for "push" type channels.""" if communication_channel_token is not None: data["communication_channel[token]"] = communication_channel_token # OPTIONAL - skip_confirmation """Only valid for site admins and account admins m...
def delete_communication_channel_id(self, id, user_id): """ Delete a communication channel. Delete an existing communication channel. """ path = {} data = {} params = {} # REQUIRED - PATH - user_id """ID""" path["user_id"] = user_id # REQUIRED - PATH - id """ID""" path["id"] = id self.logger.debug("DELETE /api/v1/users...
def from_str(cls, string): """ Creates a literal from a string Parameters ---------- string : str If the string starts with '!', it's interpreted as a negated variable Returns ------- caspo.core.literal.Literal Created object instance """ if string[0] == '!': signature = -1 variable = string[1:] else: signature = 1 var...
def normalize_signature(func): """Decorator. Combine args and kwargs. Unpack single item tuples.""" @wraps(func) def wrapper(*args, **kwargs): if kwargs: args = args, kwargs if len(args) is 1: args = args[0] return func(args) return wrapper
def filter_commands(commands, invalid_query_starts=('DROP', 'UNLOCK', 'LOCK')): """ Remove particular queries from a list of SQL commands. :param commands: List of SQL commands :param invalid_query_starts: Type of SQL command to remove :return: Filtered list of SQL commands """ commands_with_drops = len(commands) filte...
def prepare_sql(sql, add_semicolon=True, invalid_starts=('--', '/*', '*/', ';')): """Wrapper method for PrepareSQL class.""" return PrepareSQL(sql, add_semicolon, invalid_starts).prepared
def _split_sql(self, sql): """ Generate hunks of SQL that are between the bookends. note: beginning & end of string are returned as None :return: tuple of beginning bookend, closing bookend, and contents """ bookends = ("\n", ";", "--", "/*", "*/") last_bookend_found = None start = 0 while start <= len(sql): results = ...
def _get_next_occurrence(haystack, offset, needles): """ Find next occurence of one of the needles in the haystack :return: tuple of (index, needle found) or: None if no needle was found""" # make map of first char to full needle (only works if all needles # have different first characters) firstcharmap = dict([(n[0], ...
def export_content_courses(self, course_id, export_type, skip_notifications=None): """ Export content. Begin a content export job for a course, group, or user. You can use the {api:ProgressController#show Progress API} to track the progress of the export. The migration's progress is linked to with the _progress_url_ va...
= export_type # OPTIONAL - skip_notifications """Don't send the notifications about the export to the user. Default: false""" if skip_notifications is not None: data["skip_notifications"] = skip_notifications self.logger.debug("POST /api/v1/courses/{course_id}/content_exports with query params: {params} and form data: ...
def export_content_groups(self, group_id, export_type, skip_notifications=None): """ Export content. Begin a content export job for a course, group, or user. You can use the {api:ProgressController#show Progress API} to track the progress of the export. The migration's progress is linked to with the _progress_url_ valu...
= export_type # OPTIONAL - skip_notifications """Don't send the notifications about the export to the user. Default: false""" if skip_notifications is not None: data["skip_notifications"] = skip_notifications self.logger.debug("POST /api/v1/groups/{group_id}/content_exports with query params: {params} and form data: {d...
def export_content_users(self, user_id, export_type, skip_notifications=None): """ Export content. Begin a content export job for a course, group, or user. You can use the {api:ProgressController#show Progress API} to track the progress of the export. The migration's progress is linked to with the _progress_url_ value....
= export_type # OPTIONAL - skip_notifications """Don't send the notifications about the export to the user. Default: false""" if skip_notifications is not None: data["skip_notifications"] = skip_notifications self.logger.debug("POST /api/v1/users/{user_id}/content_exports with query params: {params} and form data: {dat...
def ask(question, no_input=False): """Display a Y/n question prompt, and return a boolean""" if no_input: return True else: input_ = input('%s [Y/n] ' % question) input_ = input_.strip().lower() if input_ in ('y', 'yes', ''): return True if input_ in ('n', 'no'): return False print('Invalid selection')
def render_template(template_name, context): """Render a jinja template""" return Environment( loader=PackageLoader('remarkable') ).get_template(template_name).render(context)
def render_template_directory(deck, arguments): """Render a template directory""" output_directory = dir_name_from_title(deck.title) if os.path.exists(output_directory): if sys.stdout.isatty(): if ask( '%s already exists, shall I delete it?' % output_directory, arguments.get('--noinput') ): shutil.rmtree(output_directo...
def main(): ''' set things up ''' configs = setup(argparse.ArgumentParser()) harvester = GreyHarvester( test_domain=configs['test_domain'], test_sleeptime=TEST_SLEEPTIME, https_only=configs['https_only'], allowed_countries=configs['allowed_countries'], denied_countries=configs['denied_countries'], ports=configs['ports'...
def _extract_proxies(self, ajax_endpoint): ''' request the xml object ''' proxy_xml = requests.get(ajax_endpoint) print(proxy_xml.content) root = etree.XML(proxy_xml.content) quote = root.xpath('quote')[0] ''' extract the raw text from the body of the quote tag ''' raw_text = quote.text ''' eliminate the stuff we don't...
an empty string ''' if len(items) != 7: continue ''' we'll use this to remove the </td> from the end of each item ''' tdlen = len('</td>') ''' create proxy dict ''' proxy = Proxy( ip=items[1][:-tdlen], port=int(items[2][:-tdlen]), https=bool(items[3][:-tdlen]), latency=int(items[4][:-tdlen]), last_checked=items[5][:-td...
def _passes_filter(self, proxy): ''' avoid redudant and space consuming calls to 'self' ''' ''' validate proxy based on provided filters ''' if self.allowed_countries is not None and proxy['country'] not in self.allowed_countries: return False if self.denied_countries is not None and proxy['country'] in self.denied_cou...
def _extract_ajax_endpoints(self): ''' make a GET request to freeproxylists.com/elite.html ''' url = '/'.join([DOC_ROOT, ELITE_PAGE]) response = requests.get(url) ''' extract the raw HTML doc from the response ''' raw_html = response.text ''' convert raw html into BeautifulSoup object ''' soup = BeautifulSoup(raw_html,...
def iteritems(self): """ Iterates over all mappings Yields ------ (int,Mapping) The next pair (index, mapping) """ for m in self.mappings: yield self.indexes[m.clause][m.target], m
def from_str(cls, string): """ Creates a mapping from a string Parameters ---------- string : str String of the form `target<-clause` where `clause` is a valid string for :class:`caspo.core.clause.Clause` Returns ------- caspo.core.mapping.Mapping Created object instance """ if "<-" not in string: raise ValueError("Can...
def list_user_logins_users(self, user_id): """ List user logins. Given a user ID, return that user's logins for the given account. """ path = {} data = {} params = {} # REQUIRED - PATH - user_id """ID""" path["user_id"] = user_id self.logger.debug("GET /api/v1/users/{user_id}/logins with query params: {params} and form...
def create_user_login(self, user_id, account_id, login_unique_id, login_authentication_provider_id=None, login_integration_id=None, login_password=None, login_sis_user_id=None): """ Create a user login. Create a new login for an existing user in the given account. """ path = {} data = {} params = {} # REQUIRED - PATH -...
- login[integration_id] """Integration ID for the login. To set this parameter, the caller must be able to manage SIS permissions on the account. The Integration ID is a secondary identifier useful for more complex SIS integrations.""" if login_integration_id is not None: data["login[integration_id]"] = login_integrati...
self.logger.debug("POST /api/v1/accounts/{account_id}/logins with query params: {params} and form data: {data}".format(params=params, data=data, **path)) return self.generic_request("POST", "/api/v1/accounts/{account_id}/logins".format(**path), data=data, params=params, no_data=True)
def edit_user_login(self, id, account_id, login_integration_id=None, login_password=None, login_sis_user_id=None, login_unique_id=None): """ Edit a user login. Update an existing login for a user in the given account. """ path = {} data = {} params = {} # REQUIRED - PATH - account_id """ID""" path["account_id"] = accou...
manage SIS permissions on the account.""" if login_sis_user_id is not None: data["login[sis_user_id]"] = login_sis_user_id # OPTIONAL - login[integration_id] """Integration ID for the login. To set this parameter, the caller must be able to manage SIS permissions on the account. The Integration ID is a secondary identi...
def delete_user_login(self, id, user_id): """ Delete a user login. Delete an existing login. """ path = {} data = {} params = {} # REQUIRED - PATH - user_id """ID""" path["user_id"] = user_id # REQUIRED - PATH - id """ID""" path["id"] = id self.logger.debug("DELETE /api/v1/users/{user_id}/logins/{id} with query params:...
def list_questions_in_quiz_or_submission(self, quiz_id, course_id, quiz_submission_attempt=None, quiz_submission_id=None): """ List questions in a quiz or a submission. Returns the list of QuizQuestions in this quiz. """ path = {} data = {} params = {} # REQUIRED - PATH - course_id """ID""" path["course_id"] = course_i...
want the questions for.""" if quiz_submission_attempt is not None: params["quiz_submission_attempt"] = quiz_submission_attempt self.logger.debug("GET /api/v1/courses/{course_id}/quizzes/{quiz_id}/questions with query params: {params} and form data: {data}".format(params=params, data=data, **path)) return self.generic_r...
def create_single_quiz_question(self, quiz_id, course_id, question_answers=None, question_correct_comments=None, question_incorrect_comments=None, question_neutral_comments=None, question_points_possible=None, question_position=None, question_question_name=None, question_question_text=None, question_question_type=None,...
upon the type of question to be used.""" if question_question_type is not None: self._validate_enum(question_question_type, ["calculated_question", "essay_question", "file_upload_question", "fill_in_multiple_blanks_question", "matching_question", "multiple_answers_question", "multiple_choice_question", "multiple_dropdo...
question[neutral_comments] """The comment to display regardless of how the student answered.""" if question_neutral_comments is not None: data["question[neutral_comments]"] = question_neutral_comments # OPTIONAL - question[text_after_answers] """no description""" if question_text_after_answers is not None: data["questi...
def escape(s, quote=False): """Replace special characters "&", "<" and ">" to HTML-safe sequences. If the optional flag `quote` is `True`, the quotation mark character is also translated. There is a special handling for `None` which escapes to an empty string. :param s: the string to escape. :param quote: set to true t...
def request(self, action, data={}, headers={}, method='GET'): """ Append the user authentication details to every incoming request """ data = self.merge(data, {'user': self.username, 'password': self.password, 'api_id': self.apiId}) return Transport.request(self, action, data, headers, method)
def sendMessage(self, to, message, extra={}): """ If the 'to' parameter is a single entry, we will parse it into a list. We will merge default values into the request data and the extra parameters provided by the user. """ to = to if isinstance(to, list) else [to] to = [str(i) for i in to] data = {'to': ','.join(to), '...
for consistency content = content if isinstance(content, list) else [content] result = [] # Sending messages will also result in a "stable" response. The reason # for this is that we can't actually know if the request failed or not...a message # that could not be delivered is different from a failed request...so errors...
def stopMessage(self, apiMsgId): """ See parent method for documentation """ content = self.parseLegacy(self.request('http/delmsg', {'apimsgid': apiMsgId})) return { 'id': content['ID'], 'status': content['Status'], 'description': self.getStatus(content['Status']) }
def getMessageCharge(self, apiMsgId): """ See parent method for documentation """ content = self.parseLegacy(self.request('http/getmsgcharge', {'apimsgid': apiMsgId})) return { 'id': apiMsgId, 'status': content['status'], 'description': self.getStatus(content['status']), 'charge': float(content['charge']) }
def routeCoverage(self, msisdn): """ If the route coverage lookup encounters an error, we will treat it as "not covered". """ try: content = self.parseLegacy(self.request('utils/routeCoverage', {'msisdn': msisdn})) return { 'routable': True, 'destination': msisdn, 'charge': float(content['Charge']) } except Exception: ...
def clean_publish_dates(self): """ If an end_date value is provided, the start_date must be less. """ if self.end_date: if not self.start_date: raise ValidationError("""The End Date requires a Start Date value.""") elif self.end_date <= self.start_date: raise ValidationError("""The End Date must not precede the Start D...
def clean_videos(self): """ Validates that all values in the video list are integer ids and removes all None values. """ if self.videos: self.videos = [int(v) for v in self.videos if v is not None and is_valid_digit(v)]
def clean_super_features(self): """ Removes any null & non-integer values from the super feature list """ if self.super_features: self.super_features = [int(sf) for sf in self.super_features if sf is not None and is_valid_digit(sf)]
def save(self, *args, **kwargs): """Saving ensures that the slug, if not set, is set to the slugified name.""" self.clean() if not self.slug: self.slug = slugify(self.name) super(SpecialCoverage, self).save(*args, **kwargs) if self.query and self.query != {}: # Always save and require client to filter active date range...
def _save_percolator(self): """ Saves the query field as an elasticsearch percolator """ index = Content.search_objects.mapping.index query_filter = self.get_content(published=False).to_dict() q = {} if "query" in query_filter: q = {"query": query_filter.get("query", {})} else: # We don't know how to save this return #...
datetime_to_epoch_seconds(q["end_date"]) # Store manually included IDs for percolator retrieval scoring (boost # manually included content). if self.query: q['included_ids'] = self.query.get('included_ids', []) es.index( index=index, doc_type=".percolator", body=q, id=self.es_id )
def contents(self): """performs .get_content() and caches it in a ._content property """ if not hasattr(self, "_content"): self._content = self.get_content() return self._content
def has_pinned_content(self): """determines if the there is a pinned object in the search """ if "query" in self.query: q = self.query["query"] else: q = self.query if "pinned_ids" in q: return bool(len(q.get("pinned_ids", []))) return False
def custom_template_name(self): """ Returns the path for the custom special coverage template we want. """ base_path = getattr(settings, "CUSTOM_SPECIAL_COVERAGE_PATH", "special_coverage/custom") if base_path is None: base_path = "" return "{0}/{1}_custom.html".format( base_path, self.slug.replace("-", "_") ).lstrip("/...
def deconstruct(self): """ to support Django 1.7 migrations, see also the add_introspection_rules section at bottom of this file for South + earlier Django versions """ name, path, args, kwargs = super( ExclusiveBooleanField, self).deconstruct() if self._on_fields: kwargs['on'] = self._on_fields return name, path, args...
def train_token(self, word, count): """ Trains a particular token (increases the weight/count of it) :param word: the token we're going to train :type word: str :param count: the number of occurances in the sample :type count: int """ if word not in self.tokens: self.tokens[word] = 0 self.tokens[word] += count self.tal...
def untrain_token(self, word, count): """ Untrains a particular token (decreases the weight/count of it) :param word: the token we're going to train :type word: str :param count: the number of occurances in the sample :type count: int """ if word not in self.tokens: return # If we're trying to untrain more tokens than ...
def sync_apps(self, connection, app_labels): "Runs the old syncdb-style operation on a list of app_labels." cursor = connection.cursor() try: # Get a list of already installed *models* so that references work right. tables = connection.introspection.table_names(cursor) created_models = set() # Build the manifest of app...
self.verbosity >= 1: self.stdout.write(" Creating tables...\n") with transaction.atomic(using=connection.alias, savepoint=connection.features.can_rollback_ddl): with connection.schema_editor() as editor: editor.execute("CREATE SCHEMA {}".format(settings.POSTGRES_TEMPLATE_SCHEMA)) statements = editor.connection.ops.prep...
def get_database_rows(self, tables=None, database=None): """Retrieve a dictionary of table keys and list of rows values for every table.""" # Get table data and columns from source database source = database if database else self.database tables = tables if tables else self.tables # Get database select queries commands...
def _get_select_commands(self, source, tables): """ Create select queries for all of the tables from a source database. :param source: Source database name :param tables: Iterable of table names :return: Dictionary of table keys, command values """ # Create dictionary of select queries row_queries = {tbl: self.select_a...
def _execute_select_commands(self, source, commands): """Execute select queries for all of the tables from a source database.""" rows = {} for tbl, command in tqdm(commands, total=len(commands), desc='Executing {0} select queries'.format(source)): # Add key to dictionary if tbl not in rows: rows[tbl] = [] rows[tbl].ext...
def get_database_columns(self, tables=None, database=None): """Retrieve a dictionary of columns.""" # Get table data and columns from source database source = database if database else self.database tables = tables if tables else self.tables return {tbl: self.get_columns(tbl) for tbl in tqdm(tables, total=len(tables), ...
def _get_insert_commands(self, rows, cols): """Retrieve dictionary of insert statements to be executed.""" # Get insert queries insert_queries = {} for table in tqdm(list(rows.keys()), total=len(list(rows.keys())), desc='Getting insert rows queries'): insert_queries[table] = {} _rows = rows.pop(table) _cols = cols.pop(...
def copy_database_structure(self, source, destination, tables=None): """Copy multiple tables from one database to another.""" # Change database to source self.change_db(source) if tables is None: tables = self.tables # Change database to destination self.change_db(destination) for t in tqdm(tables, total=len(tables), d...
def copy_table_structure(self, source, destination, table): """ Copy a table from one database to another. :param source: Source database :param destination: Destination database :param table: Table name """ self.execute('CREATE TABLE {0}.{1} LIKE {2}.{1}'.format(destination, wrap(table), source))
def copy_database_data(self, source, destination, optimized=False): """ Copy the data from one database to another. Retrieve existing data from the source database and insert that data into the destination database. """ # Change database to source self.enable_printing = False self.change_db(source) tables = self.tables...
def _copy_database_data_serverside(self, source, destination, tables): """Select rows from a source database and insert them into a destination db in one query""" for table in tqdm(tables, total=len(tables), desc='Copying table data (optimized)'): self.execute('INSERT INTO {0}.{1} SELECT * FROM {2}.{1}'.format(destinat...
def _copy_database_data_clientside(self, tables, source, destination): """Copy the data from a table into another table.""" # Retrieve database rows rows = self.get_database_rows(tables, source) # Retrieve database columns cols = self.get_database_columns(tables, source) # Validate rows and columns for r in list(rows.k...
def copy_database(self, source, destination): """ Copy a database's content and structure. SMALL Database speed improvements (DB size < 5mb) Using optimized is about 178% faster Using one_query is about 200% faster LARGE Database speed improvements (DB size > 5mb) Using optimized is about 900% faster Using one_query is...
tables structure for table in tqdm(tables, total=len(tables), desc='Copying {0} table structures'.format(source)): self.execute('CREATE TABLE {0}.{1} LIKE {2}.{1}'.format(destination, wrap(table), source)) # Copy tables data for table in tqdm(tables, total=len(tables), desc='Copying {0} table data'.format(source)): sel...
def recode_curesim_reads( curesim_fastq_fo, rnf_fastq_fo, fai_fo, genome_id, number_of_read_tuples=10**9, recode_random=False, ): """Recode CuReSim output FASTQ file to the RNF-compatible output FASTQ file. Args: curesim_fastq_fo (file object): File object of CuReSim FASTQ file. fastq_rnf_fo (file object): File object ...
read_tuple_id_width = len(format(number_of_read_tuples, 'x')) fq_creator = rnftools.rnfformat.FqCreator( fastq_fo=rnf_fastq_fo, read_tuple_id_width=read_tuple_id_width, genome_id_width=2, chr_id_width=fai_index.chr_id_width, coor_width=fai_index.coor_width, info_reads_in_tuple=True, info_simulator="curesim", ) # parsin...
end_pos += len(bases) if recode_random: left = 0 right = 0 else: left = start_pos + 1 right = end_pos segment = rnftools.rnfformat.Segment( genome_id=genome_id, chr_id=chr_id, direction=direction, left=left, right=right, ) elif i % 4 == 2: pass elif i % 4 == 3: qualities = line.strip() if random == recode_random: fq_cr...
def get_config_dir(program='', system_wide=False): '''Get the configuration directory. Get the configuration directories, optionally for a specific program. Args: program (str) : The name of the program whose configuration directories have to be found. system_wide (bool): Gets the system-wide configuration directories....
if os.path.isdir(os.path.join(home, app + '.d')): homes.append(os.path.join(home, app + '.d')) return homes app_homes = __find_homes(program, config_homes) # Special Cases if program == 'vim': app_homes.extend(__find_homes('vimfiles', config_homes)) elif program == 'chrome': app_homes.extend(__find_homes('google-chrome...
def get_config_file(program, system_wide=False): '''Get the configuration file for a program. Gets the configuration file for a given program, assuming it stores it in a standard location. See also :func:`get_config_dir()`. Args: program (str): The program for which to get the configuration file. system_wide (bool):Whe...
def get_tasks_changed_since(self, since): """ Returns a list of tasks that were changed recently.""" changed_tasks = [] for task in self.client.filter_tasks({'status': 'pending'}): if task.get( 'modified', task.get( 'entry', datetime.datetime(2000, 1, 1).replace(tzinfo=pytz.utc) ) ) >= since: changed_tasks.append(task)...
def evergreen(self, included_channel_ids=None, excluded_channel_ids=None, **kwargs): """ Search containing any evergreen piece of Content. :included_channel_ids list: Contains ids for channel ids relevant to the query. :excluded_channel_ids list: Contains ids for channel ids excluded from the query. """ eqs = self.sear...
def evergreen_video(self, **kwargs): """Filter evergreen content to exclusively video content.""" eqs = self.evergreen(**kwargs) eqs = eqs.filter(VideohubVideo()) return eqs
def instant_articles(self, **kwargs): """ QuerySet including all published content approved for instant articles. Instant articles are configured via FeatureType. FeatureType.instant_article = True. """ eqs = self.search(**kwargs).sort('-last_modified', '-published') return eqs.filter(InstantArticle())
def sponsored(self, **kwargs): """Search containing any sponsored pieces of Content.""" eqs = self.search(**kwargs) eqs = eqs.filter(AllSponsored()) published_offset = getattr(settings, "RECENT_SPONSORED_OFFSET_HOURS", None) if published_offset: now = timezone.now() eqs = eqs.filter( Published( after=now - timezone.tim...
def search(self, **kwargs): """ Query using ElasticSearch, returning an elasticsearch queryset. :param kwargs: keyword arguments (optional) * query : ES Query spec * tags : content tags * types : content types * feature_types : featured types * published : date range """ search_query = super(ContentManager, self).searc...
exclusion_filter = ~es_filter.Ids(values=kwargs.get("excluded_ids", [])) search_query = search_query.filter(exclusion_filter) tag_filter = Tags(kwargs.get("tags", [])) search_query = search_query.filter(tag_filter) author_filter = Authors(kwargs.get("authors", [])) search_query = search_query.filter(author_filter) feat...
def get_obj_class(self, obj_type): """ Returns the object class based on parent and object types. In most cases the object class can be derived from object type alone but sometimes the same object type name is used for different object types so the parent (or even grandparent) type is required in order to determine the...
def get_attribute(self, attribute): """ :param attribute: requested attributes. :return: attribute value. :raise TgnError: if invalid attribute. """ value = self.api.getAttribute(self.obj_ref(), attribute) # IXN returns '::ixNet::OK' for invalid attributes. We want error. if value == '::ixNet::OK': raise TgnError(self....
def get_list_attribute(self, attribute): """ :return: attribute value as Python list. """ list_attribute = self.api.getListAttribute(self.obj_ref(), attribute) # IXN returns '::ixNet::OK' for invalid attributes. We want error. if list_attribute == ['::ixNet::OK']: raise TgnError(self.ref + ' does not have attribute ' +...
def get_children(self, *types): """ Read (getList) children from IXN. Use this method to align with current IXN configuration. :param types: list of requested children. :return: list of all children objects of the requested types. """ children_objs = OrderedDict() if not types: types = self.get_all_child_types(self.obj...
def get_child_static(self, objType, seq_number=None): """ Returns IxnObject representing the requested child without reading it from the IXN. Statically build the child object reference based on the requested object type and sequence number and build the IxnObject with this calculated object reference. Ideally we would...
def get_ref_indices(self): """ :return: list of all indices in object reference. """ ixn_obj = self ref_indices = [] while ixn_obj != ixn_obj.root: ref_indices.append(ixn_obj.ref.split(':')[-1]) ixn_obj = ixn_obj.parent return ref_indices[::-1]
def list_conversations(self, filter=None, filter_mode=None, include=None, include_all_conversation_ids=None, interleave_submissions=None, scope=None): """ List conversations. Returns the list of conversations for the current user, most recent ones first. """ path = {} data = {} params = {} # OPTIONAL - scope """When se...
is not None: params["filter"] = filter # OPTIONAL - filter_mode """When filter[] contains multiple filters, combine them with this mode, filtering conversations that at have at least all of the contexts ("and") or at least one of the contexts ("or")""" if filter_mode is not None: self._validate_enum(filter_mode, ["and"...
same order.""" if include_all_conversation_ids is not None: params["include_all_conversation_ids"] = include_all_conversation_ids # OPTIONAL - include """"participant_avatars":: Optionally include an "avatar_url" key for each user participanting in the conversation""" if include is not None: self._validate_enum(include...
def create_conversation(self, body, recipients, attachment_ids=None, context_code=None, filter=None, filter_mode=None, group_conversation=None, media_comment_id=None, media_comment_type=None, mode=None, scope=None, subject=None, user_note=None): """ Create a conversation. Create a new conversation with one or more reci...
to false. If true, this will be a group conversation (i.e. all recipients may see all messages and replies). If false, individual private conversations will be started with each recipient. Must be set false if the number of recipients is over the set maximum (default is 100).""" if group_conversation is not None: data[...
None: self._validate_enum(media_comment_type, ["audio", "video"]) data["media_comment_type"] = media_comment_type # OPTIONAL - user_note """Will add a faculty journal entry for each recipient as long as the user making the api call has permission, the recipient is a student and faculty journals are enabled in the accou...
scope """Used when generating "visible" in the API response. See the explanation under the {api:ConversationsController#index index API action}""" if scope is not None: self._validate_enum(scope, ["unread", "starred", "archived"]) data["scope"] = scope # OPTIONAL - filter """Used when generating "visible" in the API re...
with query params: {params} and form data: {data}".format(params=params, data=data, **path)) return self.generic_request("POST", "/api/v1/conversations".format(**path), data=data, params=params, no_data=True)
def get_single_conversation(self, id, auto_mark_as_read=None, filter=None, filter_mode=None, interleave_submissions=None, scope=None): """ Get a single conversation. Returns information for a single conversation for the current user. Response includes all fields that are present in the list/index action as well as mess...
the API response. See the explanation under the {api:ConversationsController#index index API action}""" if filter is not None: params["filter"] = filter # OPTIONAL - filter_mode """Used when generating "visible" in the API response. See the explanation under the {api:ConversationsController#index index API action}""" i...
def edit_conversation(self, id, conversation_starred=None, conversation_subscribed=None, conversation_workflow_state=None, filter=None, filter_mode=None, scope=None): """ Edit a conversation. Updates attributes for a single conversation. """ path = {} data = {} params = {} # REQUIRED - PATH - id """ID""" path["id"] = i...
user's view of the conversation.""" if conversation_starred is not None: data["conversation[starred]"] = conversation_starred # OPTIONAL - scope """Used when generating "visible" in the API response. See the explanation under the {api:ConversationsController#index index API action}""" if scope is not None: self._valida...