MCPcopy Create free account
hub / github.com/ccxt/ccxt / write_file

Method write_file

python/ccxt/base/exchange.py:511–525  ·  view source on GitHub ↗

Write file contents (synchronous) :param str path: File path to write :param str data: Data to write :param str encoding: File encoding (default: 'utf-8') :returns bool: True if successful, False otherwise

(self, path: str, data: str, encoding: str = 'utf-8')

Source from the content-addressed store, hash-verified

509 return None
510
511 def write_file(self, path: str, data: str, encoding: str = 'utf-8'):
512 """
513 Write file contents (synchronous)
514 :param str path: File path to write
515 :param str data: Data to write
516 :param str encoding: File encoding (default: 'utf-8')
517 :returns bool: True if successful, False otherwise
518 """
519 self._ensure_whitelisted_file(path)
520 try:
521 with open(path, 'w', encoding=encoding) as file:
522 file.write(data)
523 return True
524 except Exception:
525 return False
526
527 def exists_file(self, path: str):
528 """

Callers 1

test_ioFunction · 0.95

Calls 3

writeMethod · 0.80
openFunction · 0.50

Tested by 1

test_ioFunction · 0.76