Skip to content

Switches server import to parse CSV string input#158

Closed
aschumann-virtualcable wants to merge 1 commit intov4.0from
dev/andres/v4.0-importcsv
Closed

Switches server import to parse CSV string input#158
aschumann-virtualcable wants to merge 1 commit intov4.0from
dev/andres/v4.0-importcsv

Conversation

@aschumann-virtualcable
Copy link
Contributor

This pull request updates the importcsv method in servers_management.py to change how CSV data is processed for server group imports. Instead of expecting a JSON array of arrays, the method now expects a single CSV string, and uses Python's csv module for parsing. This improves compatibility with standard CSV formats and simplifies input handling.

CSV Import Refactor:

  • Changed the input format for the importcsv method to accept a CSV string instead of a JSON array of arrays, aligning with standard CSV handling practices.
  • Introduced the use of Python's built-in csv module and io.StringIO to parse the CSV string, replacing manual iteration over a list of lists. [1] [2]

Code Cleanup:

  • Removed unnecessary .strip() calls on parsed CSV fields, as the csv reader already handles whitespace appropriately, and simplified MAC address normalization.
    [Copilot is generating a summary...]

Updates the import logic to accept a CSV-formatted string
instead of a JSON array, improving compatibility and
aligning with common data exchange formats. Enhances
input handling by leveraging the CSV parser for more
robust processing and easier integration.
@aschumann-virtualcable
Copy link
Contributor Author

Other changes

@aschumann-virtualcable aschumann-virtualcable deleted the dev/andres/v4.0-importcsv branch March 13, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants