The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Python code to create new database and database user via the cPanel API.

Discussion in 'cPanel Developers' started by skynil121, Nov 3, 2014.

  1. skynil121

    skynil121 Registered

    Joined:
    Nov 3, 2014
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    hello,
    I want to need python script to create new databse and database user via cpanel api. I have tried /https://github.com/vexxhost/python-cpanelapi and /https://github.com/oznu/pycpanel but i am trouble with verified HTTPS certificate problem. I want an easier solution to create new databse and database user via cpanel api.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,808
    Likes Received:
    667
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    Could you elaborate further on the specific error message you were encountering?

    Thank you.
     
  3. oznu

    oznu Registered

    Joined:
    Nov 7, 2014
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    When using /https://github.com/oznu/pycpanel the default settings make the connection use SSL but does not require the SSL certificate to be valid.

    When executing your script you may see a warning in the console from the "Requests" library (which is one of pycpanel's dependencies) because it is not verifying the SSL certificate. This error only shows up once and does not prevent the script from executing.

    You can enable SSL verification by adding the "verify=True" parameter to the server connection command, or you can disable SSL and execute your command over HTTP:2086 by setting "ssl=False".

    Example:

    server = pycpanel.conn("myserver.com.au", hash="server-remote-access-hash", ssl=False)
     
  4. cPDavidN

    cPDavidN cPanel Developer
    Staff Member

    Joined:
    Mar 19, 2013
    Messages:
    42
    Likes Received:
    3
    Trophy Points:
    8
    cPanel Access Level:
    DataCenter Provider
    I've had trouble using port 2086 for API requests, because many servers automatically redirect to SSL. If you have that option turned on in Tweak Settings, and your certificate is self-signed, your only option will be to leave certificate validation turned off.
     
Loading...

Share This Page