civis.io.civis_to_file

civis.io.civis_to_file(file_id, buf, api_key=None, client=None)[source]

Download a file from Civis.

Parameters:

file_id : int

The Civis file ID.

buf : file-like object

The file or other buffer to write the contents of the Civis file into.

api_key : DEPRECATED str, optional

Your Civis API key. If not given, the CIVIS_API_KEY environment variable will be used.

client : civis.APIClient, optional

If not provided, an civis.APIClient object will be created from the CIVIS_API_KEY.

Returns:

None

Examples

>>> file_id = 100
>>> with open("my_file.txt", "wb") as f:
...    civis_to_file(file_id, f)