in api-reference-examples/python/pytx/pytx/common.py [0:0]
def objects(cls,
text=None,
strict_text=False,
type_=None,
sample_type=None,
fields=None,
limit=None,
since=None,
until=None,
include_expired=False,
max_confidence=None,
min_confidence=None,
owner=None,
status=None,
review_status=None,
share_level=None,
sort_by=None,
sort_order=None,
__raw__=None,
full_response=False,
dict_generator=False,
request_dict=False,
retries=None,
headers=None,
tags=None,
proxies=None,
verify=None):
"""
Get objects from ThreatExchange.
:param text: The text used for limiting the search.
:type text: str
:param strict_text: Whether we should use strict searching.
:type strict_text: bool, str, int
:param type_: The Indicator type to limit to.
:type type_: str
:param sample_type: The Sample type to limit to.
:type sample_type: str
:param fields: Select specific fields to pull
:type fields: str, list
:param limit: The maximum number of objects to return.
:type limit: int, str
:param since: The timestamp to limit the beginning of the search.
:type since: str
:param tags: The threat tags you want to filter by.
:type tags: str, list
:param until: The timestamp to limit the end of the search.
:type until: str
:param include_expired: Include expired content in your results.
:type include_expired: bool
:param max_confidence: The max confidence level to search for.
:type max_confidence: int
:param min_confidence: The min confidence level to search for.
:type min_confidence: int
:param owner: The owner to limit to. This can be comma-delimited to
include multiple owners.
:type owner: str
:param status: The status to limit to.
:type status: str
:param review_status: The review status to limit to.
:type review_status: str
:param share_level: The share level to limit to.
:type share_level: str
:param sort_by: Sort by relevance or create time.
:type sort_by: str
:param sort_order: The sort order for results. Ascending or descending.
:type sort_order: str
:param __raw__: Provide a dictionary to force as GET parameters.
Overrides all other arguments.
:type __raw__: dict
:param full_response: Return the full response instead of the generator.
Takes precedence over dict_generator.
:type full_response: bool
:param dict_generator: Return a dictionary instead of an instantiated
object.
:type dict_generator: bool
:param request_dict: Return a request dictionary only.
:type request_dict: bool
:param retries: Number of retries to fetch a page before stopping.
:type retries: int
:param headers: header info for requests.
:type headers: dict
:param proxies: proxy info for requests.
:type proxies: dict
:param verify: verify info for requests.
:type verify: bool, str
:returns: Generator, dict (using json.loads()), str
"""
if fields is None:
fields = cls._default_fields
if __raw__:
if isinstance(__raw__, dict):
params = __raw__
else:
raise pytxValueError('__raw__ must be of type dict')
else:
params = Broker.build_get_parameters(
text=text,
strict_text=strict_text,
type_=type_,
sample_type=sample_type,
fields=fields,
limit=limit,
since=since,
until=until,
include_expired=include_expired,
max_confidence=max_confidence,
min_confidence=min_confidence,
owner=owner,
status=status,
review_status=review_status,
share_level=share_level,
sort_by=sort_by,
sort_order=sort_order,
)
if request_dict:
return Broker.request_dict('GET',
cls._URL,
params=params)
if full_response:
return Broker.get(cls._URL,
params=params,
retries=retries,
headers=headers,
proxies=proxies,
verify=verify)
else:
return Broker.get_generator(cls,
cls._URL,
to_dict=dict_generator,
params=params,
retries=retries,
headers=headers,
proxies=proxies,
verify=verify)