Skip to content

Instantly share code, notes, and snippets.

@gurneyalex
Created January 16, 2017 16:25
Show Gist options
  • Save gurneyalex/73eafee382fcc1d1e096c06e3b267629 to your computer and use it in GitHub Desktop.
Save gurneyalex/73eafee382fcc1d1e096c06e3b267629 to your computer and use it in GitHub Desktop.
interacting with web page auth='user'
import requests
import random
server = 'http://localhost:8069'
session = requests.Session()
session.headers.update({'Content-Type': 'application/json'})
data = {"jsonrpc": "2.0",
"id": random.randint(0, 1000000000),
"method": "call",
}
data['params'] = {
"db": 'odoodb',
"login": 'admin',
"password": 'admin',
"base_location": server,
}
res = session.post(server + '/web/session/authenticate', json=data)
session_id = res.json()['result']['session_id']
session.post(server + '/connector_esb/contract',
json={"id": 998, "label": "test call55"},
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment