import pyglab.apirequest

class Pyglab(object):
    def __init__(self, token):
        self.token = token
        self.headers = {'PRIVATE-TOKEN', token}
        self.user = None

    def sudo(self, user):
        """Permanently set a different username. Returns the old username."""

        previous_user = self.user
        self.user = user
        return previous_user

@@ -1,96 +1,287 @@
-import pyglab.apirequest%0A%0Aclass Pyglab(object):%0A    def __init__(self, token):%0A        self.
+_defaults = %7B%0A    'api_url': 'api/v3',%0A%7D%0A%0Afrom .apirequest import ApiRequest, RequestType%0Afrom .users import Users%0A%0Aclass Pyglab(object):%0A    def __init__(self, url, token, api_url=_defaults%5B'api_url'%5D):%0A        self._base_url = url.rstrip('/') + '/' + api_url.strip()%0A        self._
 toke
@@ -307,42 +307,20 @@
 elf.
-head
+_us
 er
-s
  = 
-%7B'PRIVATE-TOKEN', token%7D
+None
 %0A   
@@ -329,20 +329,25 @@
    self.
-user
+_per_page
  = None%0A
@@ -451,17 +451,16 @@
 ame.%22%22%22%0A
-%0A
         
@@ -476,24 +476,25 @@
 user = self.
+_
 user%0A       
@@ -499,16 +499,17 @@
    self.
+_
 user = u
@@ -537,12 +537,736 @@
 evious_user%0A
+%0A    def request(self, request_type, url, params=%7B%7D, sudo=None, page=None,%0A                per_page=None):%0A        if sudo is None and self._user is not None:%0A            sudo = _self.user%0A        if per_page is None and self._per_page is None:%0A            per_page = self._per_page%0A        r = ApiRequest(request_type, self._base_url + '/' + url.lstrip('/'),%0A                       self._token, params, sudo, page, per_page)%0A        return r.content%0A%0A    @property%0A    def users(self):%0A        u = self.request(RequestType.GET, '/users')%0A        return Users(u)%0A%0A    def users_by_name(self, name):%0A        params = %7B'search': name%7D%0A        u = self.request(RequestType.GET, '/users', params=params)%0A        return Users(u)%0A

Add users/users_by_name methods.