Search is not available for this dataset
text stringlengths 75 104k |
|---|
def media(self):
"""Media defined as a dynamic property instead of an inner class."""
media = super(JqueryMediaMixin, self).media
js = []
if JQUERY_URL:
js.append(JQUERY_URL)
elif JQUERY_URL is not False:
vendor = '' if django.VERSION < (1, 9, 0) else 'v... |
def media(self):
"""Media defined as a dynamic property instead of an inner class."""
media = super(ChainedSelect, self).media
js = ['smart-selects/admin/js/chainedfk.js',
'smart-selects/admin/js/bindfields.js']
media += Media(js=js)
return media |
def _get_available_choices(self, queryset, value):
"""
get possible choices for selection
"""
item = queryset.filter(pk=value).first()
if item:
try:
pk = getattr(item, self.chained_model_field + "_id")
filter = {self.chained_model_field... |
def media(self):
"""Media defined as a dynamic property instead of an inner class."""
media = super(ChainedSelectMultiple, self).media
js = ['smart-selects/admin/js/chainedm2m.js',
'smart-selects/admin/js/bindfields.js']
if self.horizontal:
# For horizontal mode... |
def unicode_sorter(input):
""" This function implements sort keys for the german language according to
DIN 5007."""
# key1: compare words lowercase and replace umlauts according to DIN 5007
key1 = input.lower()
key1 = key1.replace(u"ä", u"a")
key1 = key1.replace(u"ö", u"o")
key1 = key1.repl... |
def get_raw_record(self, instance, update_fields=None):
"""
Gets the raw record.
If `update_fields` is set, the raw record will be build with only
the objectID and the given fields. Also, `_geoloc` and `_tags` will
not be included.
"""
tmp = {'objectID': self.obj... |
def _should_really_index(self, instance):
"""Return True if according to should_index the object should be indexed."""
if self._should_index_is_method:
is_method = inspect.ismethod(self.should_index)
try:
count_args = len(inspect.signature(self.should_index).param... |
def save_record(self, instance, update_fields=None, **kwargs):
"""Saves the record.
If `update_fields` is set, this method will use partial_update_object()
and will update only the given fields (never `_geoloc` and `_tags`).
For more information about partial_update_object:
htt... |
def delete_record(self, instance):
"""Deletes the record."""
objectID = self.objectID(instance)
try:
self.__index.delete_object(objectID)
logger.info('DELETE %s FROM %s', objectID, self.model)
except AlgoliaException as e:
if DEBUG:
rai... |
def update_records(self, qs, batch_size=1000, **kwargs):
"""
Updates multiple records.
This method is optimized for speed. It takes a QuerySet and the same
arguments as QuerySet.update(). Optionnaly, you can specify the size
of the batch send to Algolia with batch_size (default ... |
def raw_search(self, query='', params=None):
"""Performs a search query and returns the parsed JSON."""
if params is None:
params = {}
try:
return self.__index.search(query, params)
except AlgoliaException as e:
if DEBUG:
raise e
... |
def get_settings(self):
"""Returns the settings of the index."""
try:
logger.info('GET SETTINGS ON %s', self.index_name)
return self.__index.get_settings()
except AlgoliaException as e:
if DEBUG:
raise e
else:
logger... |
def set_settings(self):
"""Applies the settings to the index."""
if not self.settings:
return
try:
self.__index.set_settings(self.settings)
logger.info('APPLY SETTINGS ON %s', self.index_name)
except AlgoliaException as e:
if DEBUG:
... |
def reindex_all(self, batch_size=1000):
"""
Reindex all the records.
By default, this method use Model.objects.all() but you can implement
a method `get_queryset` in your subclass. This can be used to optimize
the performance (for example with select_related or prefetch_related)... |
def register(model):
"""
Register the given model class and wrapped AlgoliaIndex class with the Algolia engine:
@register(Author)
class AuthorIndex(AlgoliaIndex):
pass
"""
from algoliasearch_django import AlgoliaIndex, register
def _algolia_engine_wrapper(index_class):
if ... |
def handle(self, *args, **options):
"""Run the management command."""
self.stdout.write('Apply settings to index:')
for model in get_registered_model():
if options.get('model', None) and not (model.__name__ in
options['model']):
... |
def register(self, model, index_cls=AlgoliaIndex, auto_indexing=None):
"""
Registers the given model with Algolia engine.
If the given model is already registered with Algolia engine, a
RegistrationError will be raised.
"""
# Check for existing registration.
if s... |
def unregister(self, model):
"""
Unregisters the given model with Algolia engine.
If the given model is not registered with Algolia engine, a
RegistrationError will be raised.
"""
if not self.is_registered(model):
raise RegistrationError(
'{} ... |
def get_adapter(self, model):
"""Returns the adapter associated with the given model."""
if not self.is_registered(model):
raise RegistrationError(
'{} is not registered with Algolia engine'.format(model))
return self.__registered_models[model] |
def save_record(self, instance, **kwargs):
"""Saves the record.
If `update_fields` is set, this method will use partial_update_object()
and will update only the given fields (never `_geoloc` and `_tags`).
For more information about partial_update_object:
https://github.com/algo... |
def delete_record(self, instance):
"""Deletes the record."""
adapter = self.get_adapter_from_instance(instance)
adapter.delete_record(instance) |
def update_records(self, model, qs, batch_size=1000, **kwargs):
"""
Updates multiple records.
This method is optimized for speed. It takes a QuerySet and the same
arguments as QuerySet.update(). Optionally, you can specify the size
of the batch send to Algolia with batch_size (d... |
def raw_search(self, model, query='', params=None):
"""Performs a search query and returns the parsed JSON."""
if params is None:
params = {}
adapter = self.get_adapter(model)
return adapter.raw_search(query, params) |
def reindex_all(self, model, batch_size=1000):
"""
Reindex all the records.
By default, this method use Model.objects.all() but you can implement
a method `get_queryset` in your subclass. This can be used to optimize
the performance (for example with select_related or prefetch_r... |
def __post_save_receiver(self, instance, **kwargs):
"""Signal handler for when a registered model has been saved."""
logger.debug('RECEIVE post_save FOR %s', instance.__class__)
self.save_record(instance, **kwargs) |
def __pre_delete_receiver(self, instance, **kwargs):
"""Signal handler for when a registered model has been deleted."""
logger.debug('RECEIVE pre_delete FOR %s', instance.__class__)
self.delete_record(instance) |
def handle(self, *args, **options):
"""Run the management command."""
batch_size = options.get('batchsize', None)
if not batch_size:
# py34-django18: batchsize is set to None if the user don't set
# the value, instead of not be present in the dict
batch_size =... |
def handle(self, *args, **options):
"""Run the management command."""
self.stdout.write('Clear index:')
for model in get_registered_model():
if options.get('model', None) and not (model.__name__ in
options['model']):
... |
def decode_exactly(geohash):
"""
Decode the geohash to its exact values, including the error
margins of the result. Returns four float values: latitude,
longitude, the plus/minus error for latitude (as a positive
number) and the plus/minus error for longitude (as a positive
number).
"""
... |
def decode(geohash):
"""
Decode geohash, returning two strings with latitude and longitude
containing only relevant digits and with trailing zeroes removed.
"""
lat, lon, lat_err, lon_err = decode_exactly(geohash)
# Format to the number of decimals that are known
lats = "%.*f" % (max(1, int(... |
def encode(latitude, longitude, precision=12):
"""
Encode a position given in float arguments latitude, longitude to
a geohash which will have the character count precision.
"""
lat_interval, lon_interval = (-90.0, 90.0), (-180.0, 180.0)
geohash = []
bits = [ 16, 8, 4, 2, 1 ]
bit = 0
... |
def pad_to(unpadded, target_len):
"""
Pad a string to the target length in characters, or return the original
string if it's longer than the target length.
"""
under = target_len - len(unpadded)
if under <= 0:
return unpadded
return unpadded + (' ' * under) |
def normalize_cols(table):
"""
Pad short rows to the length of the longest row to help render "jagged"
CSV files
"""
longest_row_len = max([len(row) for row in table])
for row in table:
while len(row) < longest_row_len:
row.append('')
return table |
def pad_cells(table):
"""Pad each cell to the size of the largest cell in its column."""
col_sizes = [max(map(len, col)) for col in zip(*table)]
for row in table:
for cell_num, cell in enumerate(row):
row[cell_num] = pad_to(cell, col_sizes[cell_num])
return table |
def horiz_div(col_widths, horiz, vert, padding):
"""
Create the column dividers for a table with given column widths.
col_widths: list of column widths
horiz: the character to use for a horizontal divider
vert: the character to use for a vertical divider
padding: amount of padding to add to eac... |
def add_dividers(row, divider, padding):
"""Add dividers and padding to a row of cells and return a string."""
div = ''.join([padding * ' ', divider, padding * ' '])
return div.join(row) |
def md_table(table, *, padding=DEFAULT_PADDING, divider='|', header_div='-'):
"""
Convert a 2D array of items into a Markdown table.
padding: the number of padding spaces on either side of each divider
divider: the vertical divider to place between columns
header_div: the horizontal divider to plac... |
def baseId(resource_id, return_version=False):
"""Calculate base id and version from a resource id.
:params resource_id: Resource id.
:params return_version: (optional) True if You need version, returns (resource_id, version).
"""
version = 0
resource_id = resource_id + 0xC4000000 # 3288334336... |
def itemParse(item_data, full=True):
"""Parser for item data. Returns nice dictionary.
:params item_data: Item data received from ea servers.
:params full: (optional) False if you're sniping and don't need extended info. Anyone really use this?
"""
# TODO: object
# TODO: dynamically parse all d... |
def nations(timeout=timeout):
"""Return all nations in dict {id0: nation0, id1: nation1}.
:params year: Year.
"""
rc = requests.get(messages_url, timeout=timeout)
rc.encoding = 'utf-8' # guessing takes huge amount of cpu time
rc = rc.text
data = re.findall('"search.nationName.nation([0-9]+... |
def players(timeout=timeout):
"""Return all players in dict {id: c, f, l, n, r}.
id, rank, nationality(?), first name, last name.
"""
rc = requests.get('{0}{1}.json'.format(card_info_url, 'players'), timeout=timeout).json()
players = {}
for i in rc['Players'] + rc['LegendsPlayers']:
play... |
def playstyles(year=2019, timeout=timeout):
"""Return all playstyles in dict {id0: playstyle0, id1: playstyle1}.
:params year: Year.
"""
rc = requests.get(messages_url, timeout=timeout)
rc.encoding = 'utf-8' # guessing takes huge amount of cpu time
rc = rc.text
data = re.findall('"playstyl... |
def logout(self, save=True):
"""Log out nicely (like clicking on logout button).
:params save: False if You don't want to save cookies.
"""
# self.r.get('https://www.easports.com/signout', params={'ct': self._})
# self.r.get('https://accounts.ea.com/connect/clearsid', params={'c... |
def playstyles(self, year=2019):
"""Return all playstyles in dict {id0: playstyle0, id1: playstyle1}.
:params year: Year.
"""
if not self._playstyles:
self._playstyles = playstyles()
return self._playstyles |
def leagues(self, year=2019):
"""Return all leagues in dict {id0: league0, id1: league1}.
:params year: Year.
"""
if year not in self._leagues:
self._leagues[year] = leagues(year)
return self._leagues[year] |
def teams(self, year=2019):
"""Return all teams in dict {id0: team0, id1: team1}.
:params year: Year.
"""
if year not in self._teams:
self._teams[year] = teams(year)
return self._teams[year] |
def saveSession(self):
"""Save cookies/session."""
if self.cookies_file:
self.r.cookies.save(ignore_discard=True)
with open(self.token_file, 'w') as f:
f.write('%s %s' % (self.token_type, self.access_token)) |
def cardInfo(self, resource_id):
"""Return card info.
:params resource_id: Resource id.
"""
# TODO: add referer to headers (futweb)
base_id = baseId(resource_id)
if base_id in self.players:
return self.players[base_id]
else: # not a player?
... |
def searchDefinition(self, asset_id, start=0, page_size=itemsPerPage['transferMarket'], count=None):
"""Return variations of the given asset id, e.g. IF cards.
:param asset_id: Asset id / Definition id.
:param start: (optional) Start page.
:param count: (optional) Number of definitions ... |
def search(self, ctype, level=None, category=None, assetId=None, defId=None,
min_price=None, max_price=None, min_buy=None, max_buy=None,
league=None, club=None, position=None, zone=None, nationality=None,
rare=False, playStyle=None, start=0, page_size=itemsPerPage['transferM... |
def bid(self, trade_id, bid, fast=False):
"""Make a bid.
:params trade_id: Trade id.
:params bid: Amount of credits You want to spend.
:params fast: True for fastest bidding (skips trade status & credits check).
"""
method = 'PUT'
url = 'trade/%s/bid' % trade_id
... |
def club(self, sort='desc', ctype='player', defId='', start=0, count=None, page_size=itemsPerPage['club'],
level=None, category=None, assetId=None, league=None, club=None,
position=None, zone=None, nationality=None, rare=False, playStyle=None):
"""Return items in your club, excluding c... |
def clubStaff(self):
"""Return staff in your club."""
method = 'GET'
url = 'club/stats/staff'
rc = self.__request__(method, url)
return rc |
def clubConsumables(self, fast=False):
"""Return all consumables from club."""
method = 'GET'
url = 'club/consumables/development'
rc = self.__request__(method, url)
events = [self.pin.event('page_view', 'Hub - Club')]
self.pin.send(events, fast=fast)
events = [... |
def squad(self, squad_id=0, persona_id=None):
"""Return a squad.
:params squad_id: Squad id.
"""
method = 'GET'
url = 'squad/%s/user/%s' % (squad_id, persona_id or self.persona_id)
# pinEvents
events = [self.pin.event('page_view', 'Hub - Squads')]
self.p... |
def tradeStatus(self, trade_id):
"""Return trade status.
:params trade_id: Trade id.
"""
method = 'GET'
url = 'trade/status'
if not isinstance(trade_id, (list, tuple)):
trade_id = (trade_id,)
trade_id = (str(i) for i in trade_id)
params = {'t... |
def tradepile(self):
"""Return items in tradepile."""
method = 'GET'
url = 'tradepile'
rc = self.__request__(method, url)
# pinEvents
events = [self.pin.event('page_view', 'Hub - Transfers'), self.pin.event('page_view', 'Transfer List - List View')]
if rc.get('a... |
def sell(self, item_id, bid, buy_now, duration=3600, fast=False):
"""Start auction. Returns trade_id.
:params item_id: Item id.
:params bid: Stard bid.
:params buy_now: Buy now price.
:params duration: Auction duration in seconds (Default: 3600).
"""
method = 'PO... |
def quickSell(self, item_id):
"""Quick sell.
:params item_id: Item id.
"""
method = 'DELETE'
url = 'item'
if not isinstance(item_id, (list, tuple)):
item_id = (item_id,)
item_id = (str(i) for i in item_id)
params = {'itemIds': ','.join(item_i... |
def watchlistDelete(self, trade_id):
"""Remove cards from watchlist.
:params trade_id: Trade id.
"""
method = 'DELETE'
url = 'watchlist'
if not isinstance(trade_id, (list, tuple)):
trade_id = (trade_id,)
trade_id = (str(i) for i in trade_id)
... |
def tradepileDelete(self, trade_id): # item_id instead of trade_id?
"""Remove card from tradepile.
:params trade_id: Trade id.
"""
method = 'DELETE'
url = 'trade/%s' % trade_id
self.__request__(method, url) # returns nothing
# TODO: validate status code
... |
def sendToTradepile(self, item_id, safe=True):
"""Send to tradepile (alias for __sendToPile__).
:params item_id: Item id.
:params safe: (optional) False to disable tradepile free space check.
"""
if safe and len(
self.tradepile()) >= self.tradepile_size: # TODO?... |
def sendToWatchlist(self, trade_id):
"""Send to watchlist.
:params trade_id: Trade id.
"""
method = 'PUT'
url = 'watchlist'
data = {'auctionInfo': [{'id': trade_id}]}
return self.__request__(method, url, data=json.dumps(data)) |
def sendToSbs(self, challenge_id, item_id):
"""Send card FROM CLUB to first free slot in sbs squad."""
# TODO?: multiple item_ids
method = 'PUT'
url = 'sbs/challenge/%s/squad' % challenge_id
squad = self.sbsSquad(challenge_id)
players = []
moved = False
n... |
def applyConsumable(self, item_id, resource_id):
"""Apply consumable on player.
:params item_id: Item id of player.
:params resource_id: Resource id of consumable.
"""
# TODO: catch exception when consumable is not found etc.
# TODO: multiple players like in quickSell
... |
def messages(self):
"""Return active messages."""
method = 'GET'
url = 'activeMessage'
rc = self.__request__(method, url)
# try:
# return rc['activeMessage']
# except:
# raise UnknownError('Invalid activeMessage response') # is it even possible?
... |
def packs(self):
"""List all (currently?) available packs."""
method = 'GET'
url = 'store/purchaseGroup/cardpack'
params = {'ppInfo': True}
return self.__request__(method, url, params=params) |
def num2hex(self, num):
'''
Convert a decimal number to hexadecimal
'''
temp = ''
for i in range(0, 4):
x = self.hexChars[ ( num >> (i * 8 + 4) ) & 0x0F ]
y = self.hexChars[ ( num >> (i * 8) ) & 0x0F ]
temp += (x + y)
return temp |
def logger(name=None, save=False):
"""Init and configure logger."""
logger = logging.getLogger(name)
if save:
logformat = '%(asctime)s [%(levelname)s] [%(name)s] %(funcName)s: %(message)s (line %(lineno)d)'
log_file_path = 'fut.log' # TODO: define logpath
open(log_file_path, 'w').w... |
def get_bits_per_pixel(data_format):
"""
Returns the number of (used) bits per pixel.
So without padding.
Returns None if format is not known.
"""
if data_format in component_8bit_formats:
return 8
elif data_format in component_10bit_formats:
return 10
elif data_format in... |
def run(self):
"""
Runs its worker method.
This method will be terminated once its parent's is_running
property turns False.
"""
while self._base.is_running:
if self._worker:
self._worker()
time.sleep(self._sleep_duration) |
def represent_pixel_location(self):
"""
Returns a NumPy array that represents the 2D pixel location,
which is defined by PFNC, of the original image data.
You may use the returned NumPy array for a calculation to map the
original image to another format.
:return: A NumP... |
def width(self):
"""
:return: The width of the data component in the buffer in number of pixels.
"""
try:
if self._part:
value = self._part.width
else:
value = self._buffer.width
except InvalidParameterException:
... |
def height(self):
"""
:return: The height of the data component in the buffer in number of pixels.
"""
try:
if self._part:
value = self._part.height
else:
value = self._buffer.height
except InvalidParameterException:
... |
def data_format_value(self):
"""
:return: The data type of the data component as integer value.
"""
try:
if self._part:
value = self._part.data_format
else:
value = self._buffer.pixel_format
except InvalidParameterException:... |
def delivered_image_height(self):
"""
:return: The image height of the data component.
"""
try:
if self._part:
value = self._part.delivered_image_height
else:
value = self._buffer.delivered_image_height
except InvalidParamet... |
def x_offset(self): # TODO: Check the naming convention.
"""
:return: The X offset of the data in the buffer in number of pixels from the image origin to handle areas of interest.
"""
try:
if self._part:
value = self._part.x_offset
else:
... |
def y_offset(self):
"""
:return: The Y offset of the data in the buffer in number of pixels from the image origin to handle areas of interest.
"""
try:
if self._part:
value = self._part.y_offset
else:
value = self._buffer.offset_y
... |
def x_padding(self):
"""
Returns
:return: The X padding of the data component in the buffer in number of pixels.
"""
try:
if self._part:
value = self._part.x_padding
else:
value = self._buffer.padding_x
except Invali... |
def queue(self):
"""
Queues the buffer to prepare for the upcoming image acquisition. Once
the buffer is queued, the :class:`Buffer` object will be obsolete.
You'll have nothing to do with it.
Note that you have to return the ownership of the fetched buffers to
the :clas... |
def start_image_acquisition(self):
"""
Starts image acquisition.
:return: None.
"""
if not self._create_ds_at_connection:
self._setup_data_streams()
#
num_required_buffers = self._num_buffers
for data_stream in self._data_streams:
... |
def fetch_buffer(self, *, timeout=0, is_raw=False):
"""
Fetches the latest :class:`Buffer` object and returns it.
:param timeout: Set timeout value in second.
:param is_raw: Set :const:`True` if you need a raw GenTL Buffer module.
:return: A :class:`Buffer` object.
"""
... |
def stop_image_acquisition(self):
"""
Stops image acquisition.
:return: None.
"""
if self.is_acquiring_images:
#
self._is_acquiring_images = False
#
if self.thread_image_acquisition.is_running: # TODO
self.thread_... |
def add_cti_file(self, file_path: str):
"""
Adds a CTI file to work with to the CTI file list.
:param file_path: Set a file path to the target CTI file.
:return: None.
"""
if not os.path.exists(file_path):
self._logger.warning(
'Attempted to ... |
def remove_cti_file(self, file_path: str):
"""
Removes the specified CTI file from the CTI file list.
:param file_path: Set a file path to the target CTI file.
:return: None.
"""
if file_path in self._cti_files:
self._cti_files.remove(file_path)
... |
def _reset(self):
"""
Initializes the :class:`Harvester` object. Once you reset the
:class:`Harvester` object, all allocated resources, including buffers
and remote device, will be released.
:return: None.
"""
#
for ia in self._ias:
ia._destro... |
def update_device_info_list(self):
"""
Updates the device information list. You'll have to call this method
every time you added CTI files or plugged/unplugged devices.
:return: None.
"""
#
self._release_gentl_producers()
try:
self._open_gent... |
def _destroy_image_acquirer(self, ia):
"""
Releases all external resources including the controlling device.
"""
id_ = None
if ia.device:
#
ia.stop_image_acquisition()
#
ia._release_data_streams()
#
id_ = ... |
def is_running_on_macos():
"""
Returns a truth value for a proposition: "the program is running on a
macOS machine".
:rtype: bool
"""
pattern = re.compile('darwin', re.IGNORECASE)
return False if not pattern.search(platform.platform()) else True |
def get_sha1_signature(token, timestamp, nonce, encrypt):
"""
用 SHA1 算法生成安全签名
@param token: 票据
@param timestamp: 时间戳
@param encrypt: 密文
@param nonce: 随机字符串
@return: 安全签名
"""
try:
sortlist = [token, timestamp, nonce, to_binary(encrypt)]
sortlist.sort()
sha = h... |
def login(self, verify_code=''):
"""
登录微信公众平台
注意在实例化 ``WechatExt`` 的时候,如果没有传入 ``token`` 及 ``cookies`` ,将会自动调用该方法,无需手动调用
当且仅当捕获到 ``NeedLoginError`` 异常时才需要调用此方法进行登录重试
:param verify_code: 验证码, 不传入则为无验证码
:raises LoginVerifyCodeError: 需要验证码或验证码出错,该异常为 ``LoginError`` 的子类
... |
def get_verify_code(self, file_path):
"""
获取登录验证码并存储
:param file_path: 将验证码图片保存的文件路径
"""
url = 'https://mp.weixin.qq.com/cgi-bin/verifycode'
payload = {
'username': self.__username,
'r': int(random.random() * 10000000000000),
}
head... |
def send_message(self, fakeid, content):
"""
主动发送文本消息
:param fakeid: 用户的 UID (即 fakeid )
:param content: 发送的内容
:raises NeedLoginError: 操作未执行成功, 需要再次尝试登录, 异常内容为服务器返回的错误数据
:raises ValueError: 参数出错, 具体内容有 ``fake id not exist``
"""
url = 'https://mp.weixin.qq.... |
def get_user_list(self, page=0, pagesize=10, groupid=0):
"""
获取用户列表
返回JSON示例 ::
{
"contacts": [
{
"id": 2431798261,
"nick_name": "Doraemonext",
"remark_name": "",
... |
def stat_article_detail_list(self, page=1, start_date=str(date.today()+timedelta(days=-30)), end_date=str(date.today())):
"""
获取图文分析数据
返回JSON示例 ::
{
"hasMore": true, // 说明是否可以增加 page 页码来获取数据
"data": [
{
"i... |
def get_group_list(self):
"""
获取分组列表
返回JSON示例::
{
"groups": [
{
"cnt": 8,
"id": 0,
"name": "未分组"
},
{
"cnt": 0... |
def get_news_list(self, page, pagesize=10):
"""
获取图文信息列表
返回JSON示例::
[
{
"multi_item": [
{
"seq": 0,
"title": "98路公交线路",
"show_cover_pic": ... |
def get_dialog_message(self, fakeid, last_msgid=0, create_time=0):
"""
获取与指定用户的对话内容, 获取的内容由 ``last_msgid`` (需要获取的对话中时间最早的 **公众号发送给用户** 的消息ID) 和 ``create_time`` (需要获取的对话中时间最早的消息时间戳) 进行过滤
消息过滤规则:
1. 首先按照 ``last_msgid`` 过滤 (不需要按照 ``last_msgid`` 过滤则不需要传入此参数)
a. ``fakeid`` 为用户 ... |
def send_news(self, fakeid, msgid):
"""
向指定用户发送图文消息 (必须从图文库里选取消息ID传入)
:param fakeid: 用户的 UID (即 fakeid)
:param msgid: 图文消息 ID
:raises NeedLoginError: 操作未执行成功, 需要再次尝试登录, 异常内容为服务器返回的错误数据
:raises ValueError: 参数出错, 具体内容有 ``fake id not exist`` 及 ``message id not exist``
... |
def add_news(self, news):
"""
在素材库中创建图文消息
:param news: list 对象, 其中的每个元素为一个 dict 对象, 代表一条图文, key 值分别为 ``title``, ``author``, ``summary``,
``content``, ``picture_id``, ``from_url``, 对应内容为标题, 作者, 摘要, 内容, 素材库里的
图片ID(可通过 ``upload_file`` 函数上传获取), 来源链接。
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.