{"id":19136813,"url":"https://github.com/xelroth/cplib","last_synced_at":"2025-10-11T10:17:11.870Z","repository":{"id":227070478,"uuid":"770360355","full_name":"xelroth/CPLIB","owner":"xelroth","description":"This Python library allows you to interact with cPanel and FTP servers","archived":false,"fork":false,"pushed_at":"2024-10-27T16:57:58.000Z","size":21,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-22T18:21:01.286Z","etag":null,"topics":["cpanel","cpanel-lib","cpanel-library","ftp","ftp-lib","ftp-library","ftp-managment","ftp-server","python","python-lib","python-library"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xelroth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-11T12:20:30.000Z","updated_at":"2024-10-27T16:58:01.000Z","dependencies_parsed_at":"2024-03-11T13:41:22.964Z","dependency_job_id":"141ac58a-a255-414e-b0ee-c15393800d06","html_url":"https://github.com/xelroth/CPLIB","commit_stats":null,"previous_names":["xelroth/cplib"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xelroth/CPLIB","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xelroth%2FCPLIB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xelroth%2FCPLIB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xelroth%2FCPLIB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xelroth%2FCPLIB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xelroth","download_url":"https://codeload.github.com/xelroth/CPLIB/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xelroth%2FCPLIB/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279006841,"owners_count":26084204,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpanel","cpanel-lib","cpanel-library","ftp","ftp-lib","ftp-library","ftp-managment","ftp-server","python","python-lib","python-library"],"created_at":"2024-11-09T06:35:36.480Z","updated_at":"2025-10-11T10:17:11.853Z","avatar_url":"https://github.com/xelroth.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Instalization ♨️\r\nFirst You Have To Clone This Responsitory Using The Following Command\r\n\r\n```\r\ngit clone https://github.com/xelroth/CPLIB/\r\n```\r\nIf You Are Using Windows You Have To Download Files Or Download The Archived File\r\nThen Use The Following Command For Installing The Library And Required Libraris\r\n```\r\nPython3 setup.py install\r\n```\r\n\r\n## CPLIB Documentation 📚\r\n\r\n### CPanel Class:\r\nConstructor\r\n- cpanel = Cpanel(domain, user, password, port='2083') -\u003e Initializes a Cpanel object with the specified domain, user, password, and port.\r\n\r\nMethods\r\n- cron_jobs(data={}): Add a cron job with the specified data.\r\n- delete_cron(data={}): Delete a cron job based on the provided data.\r\n- account_ftp(data={}): Add an FTP account with the given data.\r\n- del_account_ftp(data={}): Delete an FTP account based on the provided username.\r\n- create_database(name): Create a database with the specified name.\r\n- delete_database(name): Delete a database with the specified name.\r\n\r\n### FileManager Class:\r\nConstructor\r\n- file_manager = FileManager(domain, user, password) -\u003e Initializes a FileManager object with the specified domain, user, and password.\r\n\r\nMethods\r\n- create_folder(data={}): Create a new folder with the provided data.\r\n- delete_folder(data={}): Delete a folder based on the provided data.\r\n- create_file(data={}): Create a new file with the specified data.\r\n- delete_file(data={}): Delete a file based on the provided data.\r\n- rename(data={}): Rename a file or folder to a new name.\r\n- upload(data={}): Upload a file from a URL to the specified location.\r\n- info_file(data={}): Get information about a file including its size and name.\r\n- list_content(data={}): List the contents of a folder.\r\n- copy_file(data={}): Copy a file from one location to another.\r\n- file_put(data={}): Put data into a file at the specified location.\r\n\r\n\r\n==============================\r\n### cron_jobs(data={})\r\n\r\n- This method allows you to add a new cron job to the cPanel server. It takes a dictionary data as an argument, which should contain the following keys: command, minute, day, hour, month, and weekday. The method\r\nreturns true if the cron job is added successfully, otherwise it returns an error message.\r\n\r\n```\r\ndata = {\r\n    'command': 'python script.py',\r\n    'minute': '0',\r\n    'hour': '1',\r\n    'day': '*',\r\n    'month': '*',\r\n    'weekday': '*'\r\n}\r\nresult = cpanel.cron_jobs(data)\r\nprint(result)\r\n```\r\n==============================\r\n### delete_cron(data={})\r\n\r\n- This method allows you to delete a cron job from the cPanel server. It takes a dictionary data as an argument, which should contain the line key specifying the line number of the cron job to be deleted. The method returns true if the cron job is deleted successfully, otherwise it returns an error message.\r\n\r\n```\r\ndata = {\r\n    'line': '1'\r\n}\r\nresult = cpanel.delete_cron(data)\r\nprint(result)\r\n```\r\n==============================\r\n### account_ftp(data={})\r\n\r\n- This method allows you to create a new FTP account on the cPanel server. It takes a dictionary data as an argument, which should contain the following keys: username, password, quota, and addressdir. The method returns true if the FTP account is created successfully, otherwise it returns an error message.\r\n\r\n```\r\ndata = {\r\n    'username': 'ftpuser',\r\n    'password': 'ftppassword',\r\n    'quota': '100',\r\n    'addressdir': '/public_html'\r\n}\r\nresult = cpanel.account_ftp(data)\r\nprint(result)\r\n```\r\n==============================\r\n### del_account_ftp(data={})\r\n\r\n- This method allows you to delete an FTP account from the cPanel server. It takes a dictionary data as an argument, which should contain the username key specifying the username of the FTP account to be deleted. The method returns true if the FTP account is deleted successfully, otherwise it returns an error message.\r\n\r\n```\r\ndata = {\r\n    'username': 'ftpuser'\r\n}\r\nresult = cpanel.del_account_ftp(data)\r\nprint(result)\r\n```\r\n==============================\r\n### create_database(name)\r\n\r\n- This method allows you to create a new database on the cPanel server. It takes the name of the database as an argument. The method returns true if the database is created successfully, otherwise it returns an error message.\r\n\r\n```\r\nresult = cpanel.create_database('mydatabase')\r\nprint(result)\r\n```\r\n==============================\r\n# delete_database(name)\r\n- This method allows you to delete a database from the cPanel server. It takes the name of the database as an argument. The method returns true if the database is deleted successfully, otherwise it returns an error message.\r\n\r\n```\r\nresult = cpanel.delete_database('mydatabase')\r\nprint(result)\r\n```\r\n==============================\r\n\r\n\r\n### FileManager Class ###\r\n\r\n\r\n- The FileManager class provides methods for interacting with FTP servers. To use this class, you need to instantiate an object by providing the domain, username, and password. \r\n\r\n```\r\nfile_manager = FileManager(domain, user, password)\r\n```\r\n\r\n\r\n\r\n# -\u003e connect_to_server()\r\n\r\n- This method allows you to connect to the FTP server. It returns true if the connection is successful, otherwise it returns false.\r\n\r\n```\r\nresult = file_manager.connect_to_server()\r\nprint(result)\r\n```\r\n\r\n# -\u003e create_folder(data={})\r\n\r\n- This method allows you to create a new folder on the FTP server. It takes a dictionary data as an argument, which should contain the address key specifying the address of the folder to be created. The method returns Created if the folder is created successfully, otherwise it returns Error.\r\n\r\n```\r\ndata = {\r\n    'address': '/folder/subfolder'\r\n}\r\nresult = file_manager.create_folder(data)\r\nprint(result)\r\n```\r\n\r\n# -\u003e delete_folder(data={})\r\n\r\n- This method allows you to delete a folder from the FTP server. It takes a dictionary data as an argument, which should contain the address key specifying the address of the folder to be deleted. The method returns Deleted if the folder is deleted successfully, otherwise it returns Error.\r\n\r\n```\r\ndata = {\r\n    'address': '/folder/subfolder'\r\n}\r\nresult = file_manager.delete_folder(data)\r\nprint(result)\r\n```\r\n\r\n# -\u003e create_file(data={})\r\n\r\nThis method allows you to create a new file on the FTP server. It takes a dictionary data as an argument, which should contain the address key specifying the address of the file to be created. The method returns Created if the file is created successfully, otherwise it returns Error.\r\n\r\n```\r\ndata = {\r\n    'address': '/folder/file.txt'\r\n}\r\nresult = file_manager.create_file(data)\r\nprint(result)\r\n```\r\n\r\n# -\u003e delete_file(data={})\r\n\r\n- This method allows you to delete a file from the FTP server. It takes a dictionary data as an argument, which should contain the address key specifying the address of the file to be deleted. The method returns Deleted if the file is deleted successfully, otherwise it returns Error.\r\n\r\n```\r\ndata = {\r\n    'address': '/folder/file.txt'\r\n}\r\nresult = file_manager.delete_file(data)\r\nprint(result)\r\n```\r\n\r\n# -\u003e rename(data={})\r\n\r\n- This method allows you to rename a file or folder on the FTP server. It takes a dictionary data as an argument, which should contain the address key specifying the address of the file or folder to be renamed, and  the Newaddress key specifying the new address. The method returns true if the file or folder is renamed successfully, otherwise it returns Error.\r\n\r\n```\r\ndata = {\r\n    'address': '/folder/file.txt',\r\n    'Newaddress': '/folder/newfile.txt'\r\n}\r\nresult = file_manager.rename(data)\r\nprint(result)\r\n```\r\n\r\n# -\u003e pload(data={})\r\n\r\n- This method allows you to upload a file to the FTP server from a URL. It takes a dictionary data as an argument, which should contain the url key specifying the URL of the file to be uploaded, the address key specifying the address on the FTP server where the file should be uploaded, and the namefile key specifying the name of the file. The method returns Uploaded if the file is uploaded successfully, otherwise it returns Error.\r\n\r\n\r\n# -\u003e upload(data={})\r\n\r\n- This method allows you to upload a file to the FTP server from a URL. It takes a dictionary data as an argument, which should contain the url key specifying the URL of the file to be uploaded, the address key specifying the address on the FTP server where the file should be uploaded, and the namefile key specifying the name of the file. The method returns Uploaded if the file is uploaded successfully, otherwise it returns Error.\r\n\r\n```\r\ndata = {\r\n    'url': 'https://example.com/file.txt',\r\n    'address': '/folder',\r\n    'namefile': 'file.txt'\r\n}\r\nresult = file_manager.upload(data)\r\nprint(result)\r\n```\r\n\r\n# -\u003e info_file(data={})\r\n\r\n- This method allows you to get information about a file on the FTP server. It takes a dictionary data as an argument, which should contain the address key specifying the address of the file. The method returns a dictionary with the following keys: status (True if the file exists, False otherwise), size (the size of the file), and namefile (the name of the file).\r\n\r\n\r\n```\r\ndata = {\r\n    'address': '/folder/file.txt'\r\n}\r\nresult = file_manager.info_file(data)\r\nprint(result)\r\n```\r\n\r\n# -\u003e list_content(data={})\r\n\r\n- This method allows you to list the contents of a folder on the FTP server. It takes a dictionary data as an argument, which should contain the address key specifying the address of the folder. The method returns a string containing the names of the files and folders in the specified folder.\r\n\r\n```\r\ndata = {\r\n    'address': '/folder'\r\n}\r\nresult = file_manager.list_content(data)\r\nprint(result)\r\n```\r\n\r\n# -\u003e copy_file(data={})\r\n\r\n- This method allows you to copy a file on the FTP server. It takes a dictionary data as an argument, which should contain the localaddress key specifying the local address of the file to be copied, and the Newaddress key specifying the new address on the FTP server. The method returns true if the file is copied successfully, otherwise it returns Error.\r\n\r\n```\r\ndata = {\r\n    'localaddress': 'local/file.txt',\r\n    'Newaddress': '/folder/file.txt'\r\n}\r\nresult = file_manager.copy_file(data)\r\nprint(result)\r\n```\r\n\r\n# -\u003e file_put(data={})\r\n\r\n- This method allows you to create a new file on the FTP server and write data to it. It takes a dictionary data as an argument, which should contain the address key specifying the address of the file to be created, and the data key specifying the data to be written to the file. The method returns true if the file is created and data is written successfully, otherwise it returns Error.\r\n\r\n```\r\ndata = {\r\n    'address': '/folder/file.txt',\r\n    'data': 'Hello, World!'\r\n}\r\nresult = file_manager.file_put(data)\r\nprint(result)\r\n```\r\n\r\n### Conclusion\r\n\r\n- This documentation provides an overview of the provided Python library for interacting with cPanel and FTP servers. It explains the usage of each function and provides examples to help you understand how to use the library effectively. Feel free to explore the library further and customize it according to your specific needs.\r\n\r\n\r\n\r\n🚀 Feel free to explore and use this library for your projects! 🚀\r\n\r\nFeel free to add more descriptive details, examples, or usage instructions to make the documentation more comprehensive and user-friendly. Happy coding! 📝\r\nIf You Enjoy Using This Library, Then Dont Forget TO Give A Star To It! 🌟\r\n\r\n⚠️ THIS PROJECT IS UNDER MIT LICENSE! FOLLOW THE LICENSE FILE TO GET MORE INFORMATION ⚠️\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxelroth%2Fcplib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxelroth%2Fcplib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxelroth%2Fcplib/lists"}