Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. def get_compat_backend(**kwargs):
  2. """
  3. Return a JupiterRequestsBackend instance.
  4.  
  5. Jupiter or Ascended compat interface REST API Client. Given keyword
  6. arguments, construct and return an instance of the JupiterRequestsBackend.
  7. Accepts a username/password pair or a cookie.
  8.  
  9. :param dict kwargs: Keyword arguments used to construct the backend
  10. :return: An instantiated JupiterRequestsBackend
  11. :rtype: JupiterRequestsBackend
  12. """
  13. # Defaults
  14. settings = {
  15. 'base_url': 'http://localhost/compat',
  16. 'verify': False,
  17. }
  18. # Arguments
  19. settings.update(kwargs)
  20. session = JupiterRequestsBackend.authenticate_session(
  21. settings['base_url'],
  22. settings['username'],
  23. settings['password'],
  24. verify=settings['verify'],
  25. )
  26. return JupiterRequestsBackend(
  27. session,
  28. settings['base_url'],
  29. verify=settings['verify'],
  30. username=settings['username'],
  31. password=settings['password'],
  32. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement