Created
November 4, 2019 07:27
-
-
Save anjannath/fd0a6b814dca2b0acb5908e71a593de2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import urllib2 | |
| import json | |
| def rpc_call(url, method, args): | |
| data = json.dumps({ | |
| 'id': 1, | |
| 'method': method, | |
| 'params': [args] | |
| }).encode() | |
| print data | |
| req = urllib2.Request(url, | |
| data, | |
| {'Content-Type': 'application/json'}) | |
| f = urllib2.urlopen(req) | |
| response = f.read() | |
| return json.loads(response) | |
| url = 'http://localhost:5732/rpc' | |
| args = {'Name': 'crc', 'Debug': True, 'VMDriver': 'libvirt', 'CPUs': 3, 'Memory': 10000, 'BundlePath': '/home/anjan/.crc/crc_libvirt_4.2.0.crcbundle', 'NameServer': '8.8.8.8'} | |
| print rpc_call(url, "CrcDaemon.GetStatus", args) |
anjannath
commented
Nov 4, 2019
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment