Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to upload database dump in Odoo ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 308
    Comment on it

    The upload method https://upgrade.odoo.com/database/v1/upload/ use this link to Upload a database dump Parameters

    1. key (str) -- (required) your private key
    2. request (str) -- (required) your request id
    3. Returns
    4. request result
    5. Return type
    6. json dictionary

    The request id and the private key are obtained using the create method For example see code below.

    1. import os
    2. import pycurl
    3. from urllib import urlencode
    4. from io import BytesIO
    5. import json
    6.  
    7. UPLOAD_URL = "https://upgrade.odoo.com/database/v1/upload"
    8. DUMPFILE = "openchs.70.cdump"
    9.  
    10. fields = dict([
    11. ('request', '10534'),
    12. ('key', 'Aw7pItGVKFuZ_FOR3U8VFQ=='),
    13. ])
    14. headers = {"Content-Type": "application/octet-stream"}
    15. postfields = urlencode(fields)
    16.  
    17. c = pycurl.Curl()
    18. c.setopt(pycurl.URL, UPLOAD_URL+"?"+postfields)
    19. c.setopt(pycurl.POST, 1)
    20. filesize = os.path.getsize(DUMPFILE)
    21. c.setopt(pycurl.POSTFIELDSIZE, filesize)
    22. fp = open(DUMPFILE, 'rb')
    23. c.setopt(pycurl.READFUNCTION, fp.read)
    24. c.setopt(
    25. pycurl.HTTPHEADER,
    26. ['%s: %s' % (k, headers[k]) for k in headers])
    27.  
    28. c.perform()
    29. c.close()

    Note-With the help of above method we can uploads a database dump.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Reset Password
Fill out the form below and reset your password: