Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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 Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,802
    Likes Received:
    1,895
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello :)

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

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  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:
    83
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice