MCPcopy Create free account
hub / github.com/NanmiCoder/MediaCrawler / write_to_csv

Method write_to_csv

tools/async_file_writer.py:46–54  ·  view source on GitHub ↗
(self, item: Dict, item_type: str)

Source from the content-addressed store, hash-verified

44 return f"{base_path}/{file_name}"
45
46 async def write_to_csv(self, item: Dict, item_type: str):
47 file_path = self._get_file_path('csv', item_type)
48 async with self.lock:
49 file_exists = os.path.exists(file_path)
50 async with aiofiles.open(file_path, 'a', newline='', encoding='utf-8-sig') as f:
51 writer = csv.DictWriter(f, fieldnames=item.keys())
52 if not file_exists or await f.tell() == 0:
53 await writer.writeheader()
54 await writer.writerow(item)
55
56 async def write_to_jsonl(self, item: Dict, item_type: str):
57 file_path = self._get_file_path('jsonl', item_type)

Callers 15

store_contentMethod · 0.80
store_commentMethod · 0.80
store_contentMethod · 0.80
store_commentMethod · 0.80
store_creatorMethod · 0.80
store_contactMethod · 0.80
store_dynamicMethod · 0.80
store_contentMethod · 0.80
store_commentMethod · 0.80
store_contentMethod · 0.80
store_commentMethod · 0.80
store_creatorMethod · 0.80

Calls 2

_get_file_pathMethod · 0.95
keysMethod · 0.45

Tested by

no test coverage detected