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)