Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to create request method on odoo server ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 154
    Comment on it

    If the create method is successful, the value associated to the request key will be a dictionary containing various information about the created request:
    1-id: the request id
    2-key: your private key for this request
    For example code is like below.

    from urllib import urlencode
    from io import BytesIO
    import pycurl
    import json
    
    CREATE_URL = "https://upgrade.odoo.com/database/v1/create"
    CONTRACT = "M123456-abcdef"
    AIM = "test"
    TARGET = "8.0"
    EMAIL = "john.doe@example.com"
    FILENAME = "db_name.dump"
    
    fields = dict([
        ('aim', AIM),
        ('email', EMAIL),
        ('filename', DB_SOURCE),
        ('contract', CONTRACT),
        ('target', TARGET),
    ])
    postfields = urlencode(fields)
    
    c = pycurl.Curl()
    c.setopt(pycurl.URL, CREATE_URL)
    c.setopt(c.POSTFIELDS, postfields)
    data = BytesIO()
    c.setopt(c.WRITEFUNCTION, data.write)
    c.perform()
    
    # transform output into a dict:
    response = json.loads(data.getvalue())
    
    # get http status:
    http_code = c.getinfo(pycurl.HTTP_CODE)
    c.close()
    

    Note-Above values will be requested by the other methods (upload, process and status)

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: