demo.py 864 B

1234567891011121314151617181920212223242526
  1. #-*- coding:utf-8 -*-
  2. #gaoyiping (iam@gaoyiping.com) 2017-02-18
  3. import PhalApiClient
  4. print('-' * 20)
  5. print('Request: 1')
  6. result = PhalApiClient.PhalApiClient('http://demo.phalapi.net/', 'Default.Index', {'username': 'dogstar'}, 3)
  7. print('head', result['info'])
  8. print('state', result['state'])
  9. print('result', result['data'])
  10. print('-' * 20)
  11. print('Request: 2')
  12. result = PhalApiClient.PhalApiClient('http://demo.phalapi.net/', 'User.GetBaseInfo', {'username': 'dogstar'})
  13. print('head', result['info'])
  14. print('state', result['state'])
  15. print('result', result['data'])
  16. print('-' * 20)
  17. print('Request: 3')
  18. result = PhalApiClient.PhalApiClient('http://demo.phalapi.net/')
  19. print('head', result['info'])
  20. print('state', result['state'])
  21. print('result', result['data'])
  22. print('-' * 20)
  23. print('Request: 4 (illegal request)')
  24. result = PhalApiClient.PhalApiClient(1, 2, 3, 4)