MCPcopy Create free account
hub / github.com/sammchardy/python-binance / write_function_to_endpoints_md

Function write_function_to_endpoints_md

code-generator.py:443–469  ·  view source on GitHub ↗

Append a brief reference entry to Endpoints.md, showing the usage example. First checks if the entry already exists to avoid duplicates.

(method, endpoint)

Source from the content-addressed store, hash-verified

441
442
443def write_function_to_endpoints_md(method, endpoint):
444 """
445 Append a brief reference entry to Endpoints.md, showing the usage example.
446 First checks if the entry already exists to avoid duplicates.
447 """
448 function_name = convert_to_function_name(method, endpoint)
449
450 # Check if the entry already exists
451 with open("Endpoints.md", "r", encoding="utf-8") as f:
452 content = f.read()
453 # Look for the exact method and endpoint
454 if f"**{method.upper()} {endpoint}" in content:
455 return False
456
457 # Create the entry we want to add
458 md_entry = (
459 f"\t- **{method} {endpoint}**\n"
460 f" ```python\n"
461 f" client.{function_name}(**params)\n"
462 f" ```\n\n"
463 )
464
465 # If we get here, the entry doesn't exist, so append it
466 with open("Endpoints.md", "a", encoding="utf-8") as f:
467 f.write(md_entry)
468
469 return True
470
471
472def main():

Callers 1

mainFunction · 0.85

Calls 1

convert_to_function_nameFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…