示例#1
0
文件: io.py 项目: carlcdavid/mist.io
    def list_images(self, backend_id, search_term=None, cookie=None,
                    csrf_token=None, api_token=None):

        uri = self.uri + "/backends/" + backend_id + "/images",
        if not search_term:
            req = MistRequests(uri=uri, cookie=cookie, csrf_token=csrf_token,
                               api_token=api_token)
            req.get = req.unavailable_api_call
        else:
            req = MistRequests(uri=uri, data={'search_term': search_term},
                               cookie=cookie, csrf_token=csrf_token)
            req.post = req.unavailable_api_call

        req.put = req.unavailable_api_call
        req.delete = req.unavailable_api_call

        # assert response.ok, u'\nGot %d Response Status: %s \n%s' % (response.status_code, response.reason, response.text)
        #
        # try:
        #     params = response.json()
        #     return params
        # except Exception as e:
        #     assert False, u'Exception: %s' % e

        return req
示例#2
0
 def generate_keypair(self, cookie=None, csrf_token=None, api_token=None):
     req = MistRequests(uri=self.uri + "/keys", cookie=cookie,
                        csrf_token=csrf_token, api_token=api_token)
     req.get = req.unavailable_api_call
     req.put = req.unavailable_api_call
     req.delete = req.unavailable_api_call
     return req
示例#3
0
文件: io.py 项目: carlcdavid/mist.io
    def add_backend(self, title, provider, apikey, apisecret, apiurl=None,
                    tenant_name=None, cookie=None, csrf_token=None,
                    api_token=None):

        payload = {
            'title': title,
            'provider': provider,
            'apikey': apikey,
            'apisecret': apisecret,
            'apiurl': apiurl,
            'tenant_name': tenant_name
        }

        req = MistRequests(uri=self.uri + '/backends', data=json.dumps(payload),
                           cookie=cookie, csrf_token=csrf_token,
                           api_token=api_token)

        req.get = req.unavailable_api_call
        req.put = req.unavailable_api_call
        req.delete = req.unavailable_api_call

        # assert response.ok, u'\nGot %d Response Status: %s \n%s' % (response
        # .status_code, response.reason, response.text)
        #
        # try:
        #     params = response.json()
        #     return params
        # except Exception as e:
        #     assert False, u'Exception: %s' % e

        return req
示例#4
0
文件: io.py 项目: carlcdavid/mist.io
    def create_machine(self, backend_id, key_id, name, location, image, size,
                       script=None, disk=None, image_extra=None, cookie=None,
                       csrf_token=None, api_token=None):
        #! disk and image_extra are required only for Linode
        payload = {
            #'backend': backend_id,
            'key': key_id,
            'name': name,
            'location': location,
            'image': image,
            'size': size,
            'script': script,
            'disk': disk,
            'image_extra': image_extra
        }
        req = MistRequests(uri=self.uri + "/backends/" + backend_id + "/machines",
                         cookie=cookie, data=payload, timeout=600,
                         csrf_token=csrf_token, api_token=api_token)

        req.get = req.unavailable_api_call
        req.put = req.unavailable_api_call
        req.delete = req.unavailable_api_call

        # assert response.ok, u'\nGot %d Response Status: %s \n%s' % (response.status_code, response.reason, response.text)
        #
        # try:
        #     params = response.json()
        #     print "Created machine with Name: %s and id %s a" % (params['name'], params['id'])
        #     return params
        # except Exception as e:
        #     assert False, u'Exception: %s' % e

        return req
示例#5
0
文件: io.py 项目: whjvenyl/mist.io
 def add_cloud(self,
               title,
               provider,
               apikey,
               apisecret,
               apiurl=None,
               tenant_name=None,
               cookie=None,
               csrf_token=None,
               api_token=None):
     payload = {
         'title': title,
         'provider': provider,
         'apikey': apikey,
         'apisecret': apisecret,
         'apiurl': apiurl,
         'tenant_name': tenant_name
     }
     req = MistRequests(uri=self.uri + '/clouds',
                        data=json.dumps(payload),
                        cookie=cookie,
                        csrf_token=csrf_token,
                        api_token=api_token)
     req.get = req.unavailable_api_call
     req.put = req.unavailable_api_call
     req.delete = req.unavailable_api_call
     return req
示例#6
0
    def list_clouds(self, api_token=None):

        req = MistRequests(uri=self.uri + '/clouds', api_token=api_token)
        req.post = req.unavailable_api_call
        req.put = req.unavailable_api_call
        req.delete = req.unavailable_api_call
        return req
示例#7
0
文件: io.py 项目: whjvenyl/mist.io
    def list_clouds(self, api_token=None):

        req = MistRequests(uri=self.uri + '/clouds', api_token=api_token)
        req.post = req.unavailable_api_call
        req.put = req.unavailable_api_call
        req.delete = req.unavailable_api_call
        return req
示例#8
0
 def stop_machine(self, cloud_id, machine_id, cookie=None, csrf_token=None,
                  api_token=None):
     uri = self.uri + "/clouds/" + cloud_id + "/machines/" + machine_id
     req = MistRequests(uri - uri, data={'action': 'stop'}, cookie=cookie,
                        csrf_token=csrf_token, api_token=api_token)
     req.get = req.unavailable_api_call
     req.put = req.unavailable_api_call
     req.delete = req.unavailable_api_call
     return req
示例#9
0
文件: io.py 项目: whjvenyl/mist.io
 def generate_keypair(self, cookie=None, csrf_token=None, api_token=None):
     req = MistRequests(uri=self.uri + "/keys",
                        cookie=cookie,
                        csrf_token=csrf_token,
                        api_token=api_token)
     req.get = req.unavailable_api_call
     req.put = req.unavailable_api_call
     req.delete = req.unavailable_api_call
     return req
示例#10
0
 def set_default_key(self, key_id, cookie=None, csrf_token=None,
                     api_token=None):
     req = MistRequests(uri=self.uri + "/keys/" + key_id,
                        cookie=cookie, csrf_token=csrf_token,
                        api_token=api_token)
     req.get = req.unavailable_api_call
     req.put = req.unavailable_api_call
     req.delete = req.unavailable_api_call
     return req
示例#11
0
 def list_sizes(self, cloud_id, cookie=None, csrf_token=None,
                api_token=None):
     req = MistRequests(uri=self.uri + "/clouds/" + cloud_id + "/sizes",
                        cookie=cookie, csrf_token=csrf_token,
                        api_token=api_token)
     req.post = req.unavailable_api_call
     req.put = req.unavailable_api_call
     req.delete = req.unavailable_api_call
     return req
示例#12
0
 def get_public_key(self, key_id, cookie=None, csrf_token=None,
                    api_token=None):
     req = MistRequests(uri=self.uri + "/keys/" + key_id + "/public",
                        cookie=cookie, csrf_token=csrf_token,
                        api_token=api_token)
     req.post = req.unavailable_api_call
     req.put = req.unavailable_api_call
     req.delete = req.unavailable_api_call
     return req
示例#13
0
 def edit_key(self, id, new_id, cookie=None, csrf_token=None,
              api_token=None):
     req = MistRequests(uri=self.uri + "/keys/" + id,
                        data={'new_id': new_id}, cookie=cookie,
                        csrf_token=csrf_token, api_token=api_token)
     req.get = req.unavailable_api_call
     req.post = req.unavailable_api_call
     req.delete = req.unavailable_api_call
     return req
示例#14
0
    def rename_cloud(self, cloud_id, new_name, cookie=None, csrf_token=None,
                     api_token=None):
        req = MistRequests(uri=self.uri + "/clouds/" + cloud_id,
                           data={'new_name': new_name}, cookie=cookie,
                           csrf_token=csrf_token, api_token=api_token)

        req.get = req.unavailable_api_call
        req.post = req.unavailable_api_call
        req.delete = req.unavailable_api_call
        return req
示例#15
0
文件: io.py 项目: whjvenyl/mist.io
 def get_public_key(self,
                    key_id,
                    cookie=None,
                    csrf_token=None,
                    api_token=None):
     req = MistRequests(uri=self.uri + "/keys/" + key_id + "/public",
                        cookie=cookie,
                        csrf_token=csrf_token,
                        api_token=api_token)
     req.post = req.unavailable_api_call
     req.put = req.unavailable_api_call
     req.delete = req.unavailable_api_call
     return req
示例#16
0
文件: io.py 项目: whjvenyl/mist.io
 def set_default_key(self,
                     key_id,
                     cookie=None,
                     csrf_token=None,
                     api_token=None):
     req = MistRequests(uri=self.uri + "/keys/" + key_id,
                        cookie=cookie,
                        csrf_token=csrf_token,
                        api_token=api_token)
     req.get = req.unavailable_api_call
     req.put = req.unavailable_api_call
     req.delete = req.unavailable_api_call
     return req
示例#17
0
文件: io.py 项目: whjvenyl/mist.io
 def list_machines(self,
                   cloud_id,
                   cookie=None,
                   csrf_token=None,
                   api_token=None):
     req = MistRequests(uri=self.uri + '/clouds/' + cloud_id + "/machines",
                        cookie=cookie,
                        csrf_token=csrf_token,
                        api_token=api_token)
     req.post = req.unavailable_api_call
     req.put = req.unavailable_api_call
     req.delete = req.unavailable_api_call
     return req
示例#18
0
    def add_key(self, id, private, cookie=None, csrf_token=None,
                api_token=None):
        payload = {
            'id': id,
            'priv': private
        }
        req = MistRequests(uri=self.uri + "/keys", cookie=cookie, data=payload,
                           csrf_token=csrf_token, api_token=api_token)

        req.get = req.unavailable_api_call
        req.post = req.unavailable_api_call
        req.delete = req.unavailable_api_call
        return req
示例#19
0
文件: io.py 项目: whjvenyl/mist.io
    def list_locations(self,
                       cloud_id,
                       cookie=None,
                       csrf_token=None,
                       api_token=None):
        req = MistRequests(uri=self.uri + "/clouds/" + cloud_id + "/locations",
                           cookie=cookie,
                           csrf_token=csrf_token,
                           api_token=api_token)

        req.post = req.unavailable_api_call
        req.put = req.unavailable_api_call
        req.delete = req.unavailable_api_call
        return req
示例#20
0
    def create_machine(
        self,
        backend_id,
        key_id,
        name,
        location,
        image,
        size,
        script=None,
        disk=None,
        image_extra=None,
        cookie=None,
        csrf_token=None,
        api_token=None,
    ):
        #! disk and image_extra are required only for Linode
        payload = {
            #'backend': backend_id,
            "key": key_id,
            "name": name,
            "location": location,
            "image": image,
            "size": size,
            "script": script,
            "disk": disk,
            "image_extra": image_extra,
        }
        req = MistRequests(
            uri=self.uri + "/backends/" + backend_id + "/machines",
            cookie=cookie,
            data=payload,
            timeout=600,
            csrf_token=csrf_token,
            api_token=api_token,
        )

        req.get = req.unavailable_api_call
        req.put = req.unavailable_api_call
        req.delete = req.unavailable_api_call

        # assert response.ok, u'\nGot %d Response Status: %s \n%s' % (response.status_code, response.reason, response.text)
        #
        # try:
        #     params = response.json()
        #     print "Created machine with Name: %s and id %s a" % (params['name'], params['id'])
        #     return params
        # except Exception as e:
        #     assert False, u'Exception: %s' % e

        return req
示例#21
0
文件: io.py 项目: carlcdavid/mist.io
    def edit_key(self, key_id, new_name, cookie=None, csrf_token=None,
                 api_token=None):

        req = MistRequests(uri=self.uri + "/keys/" + key_id,
                           data={'new_id': new_name}, cookie=cookie,
                           csrf_token=csrf_token, api_token=api_token)

        req.get = req.unavailable_api_call
        req.post = req.unavailable_api_call
        req.delete = req.unavailable_api_call

        # assert response.ok, u'\nGot %d Response Status: %s \n%s' % (response.status_code, response.reason, response.text)

        return req
示例#22
0
文件: io.py 项目: whjvenyl/mist.io
 def edit_key(self,
              id,
              new_id,
              cookie=None,
              csrf_token=None,
              api_token=None):
     req = MistRequests(uri=self.uri + "/keys/" + id,
                        data={'new_id': new_id},
                        cookie=cookie,
                        csrf_token=csrf_token,
                        api_token=api_token)
     req.get = req.unavailable_api_call
     req.post = req.unavailable_api_call
     req.delete = req.unavailable_api_call
     return req
示例#23
0
    def stop_machine(self, backend_id, machine_id, cookie=None, csrf_token=None, api_token=None):

        uri = self.uri + "/backends/" + backend_id + "/machines/" + machine_id
        req = MistRequests(
            uri - uri, data={"action": "stop"}, cookie=cookie, csrf_token=csrf_token, api_token=api_token
        )

        req.get = req.unavailable_api_call
        req.put = req.unavailable_api_call
        req.delete = req.unavailable_api_call

        # assert response.ok, u'\nGot %d Response Status: %s \n%s' % (response.status_code, response.reason, response.text)
        # print "Stopped machine with id: %s" % machine_id

        return req
示例#24
0
    def list_images(self, cloud_id, search_term=None, cookie=None,
                    csrf_token=None, api_token=None):
        uri = self.uri + "/clouds/" + cloud_id + "/images",
        if not search_term:
            req = MistRequests(uri=uri, cookie=cookie, csrf_token=csrf_token,
                               api_token=api_token)
            req.get = req.unavailable_api_call
        else:
            req = MistRequests(uri=uri, data={'search_term': search_term},
                               cookie=cookie, csrf_token=csrf_token)
            req.post = req.unavailable_api_call

        req.put = req.unavailable_api_call
        req.delete = req.unavailable_api_call
        return req
示例#25
0
文件: io.py 项目: carlcdavid/mist.io
    def stop_machine(self, backend_id, machine_id, cookie=None, csrf_token=None,
                     api_token=None):

        uri = self.uri + "/backends/" + backend_id + "/machines/" + machine_id
        req = MistRequests(uri-uri, data={'action': 'stop'}, cookie=cookie,
                           csrf_token=csrf_token, api_token=api_token)

        req.get = req.unavailable_api_call
        req.put = req.unavailable_api_call
        req.delete = req.unavailable_api_call

        # assert response.ok, u'\nGot %d Response Status: %s \n%s' % (response.status_code, response.reason, response.text)
        # print "Stopped machine with id: %s" % machine_id

        return req
示例#26
0
    def list_backends(self, cookie=None, csrf_token=None, api_token=None):

        req = MistRequests(uri=self.uri + "/backends", cookie=cookie, csrf_token=csrf_token, api_token=api_token)

        req.post = req.unavailable_api_call
        req.put = req.unavailable_api_call
        req.delete = req.unavailable_api_call
        # assert response.ok, u'\nGot %d Response Status: %s \n%s' % (response.status_code, response.reason, response.text)
        #
        # try:
        #     params = response.json()
        #     return params
        # except Exception as e:
        #     assert False, u'Exception: %s' %e

        return req
示例#27
0
文件: io.py 项目: whjvenyl/mist.io
    def rename_cloud(self,
                     cloud_id,
                     new_name,
                     cookie=None,
                     csrf_token=None,
                     api_token=None):
        req = MistRequests(uri=self.uri + "/clouds/" + cloud_id,
                           data={'new_name': new_name},
                           cookie=cookie,
                           csrf_token=csrf_token,
                           api_token=api_token)

        req.get = req.unavailable_api_call
        req.post = req.unavailable_api_call
        req.delete = req.unavailable_api_call
        return req
示例#28
0
    def start_machine(self, backend_id, machine_id, cookie=None, csrf_token=None, api_token=None):
        # sleep(30)
        uri = self.uri + "/backends/" + backend_id + "/machines/" + machine_id
        req = MistRequests(uri=uri, data={"action": "start"}, cookie=cookie, csrf_token=csrf_token, api_token=api_token)

        req.get = req.unavailable_api_call
        req.put = req.unavailable_api_call
        req.delete = req.unavailable_api_call

        # if response.status_code == 503:
        #     print "Machine state is not yet ready to be started"
        #     return
        # assert response.ok, u'\nGot %d Response Status: %s \n%s' % (response.status_code, response.reason, response.text)
        # print "Started machine with id: %s" % machine_id

        return req
示例#29
0
文件: io.py 项目: whjvenyl/mist.io
 def stop_machine(self,
                  cloud_id,
                  machine_id,
                  cookie=None,
                  csrf_token=None,
                  api_token=None):
     uri = self.uri + "/clouds/" + cloud_id + "/machines/" + machine_id
     req = MistRequests(uri - uri,
                        data={'action': 'stop'},
                        cookie=cookie,
                        csrf_token=csrf_token,
                        api_token=api_token)
     req.get = req.unavailable_api_call
     req.put = req.unavailable_api_call
     req.delete = req.unavailable_api_call
     return req
示例#30
0
    def edit_key(self, key_id, new_name, cookie=None, csrf_token=None, api_token=None):

        req = MistRequests(
            uri=self.uri + "/keys/" + key_id,
            data={"new_id": new_name},
            cookie=cookie,
            csrf_token=csrf_token,
            api_token=api_token,
        )

        req.get = req.unavailable_api_call
        req.post = req.unavailable_api_call
        req.delete = req.unavailable_api_call

        # assert response.ok, u'\nGot %d Response Status: %s \n%s' % (response.status_code, response.reason, response.text)

        return req
示例#31
0
文件: io.py 项目: carlcdavid/mist.io
    def list_backends(self, cookie=None, csrf_token=None, api_token=None):

        req = MistRequests(uri=self.uri + '/backends', cookie=cookie,
                           csrf_token=csrf_token, api_token=api_token)

        req.post = req.unavailable_api_call
        req.put = req.unavailable_api_call
        req.delete = req.unavailable_api_call
        # assert response.ok, u'\nGot %d Response Status: %s \n%s' % (response.status_code, response.reason, response.text)
        #
        # try:
        #     params = response.json()
        #     return params
        # except Exception as e:
        #     assert False, u'Exception: %s' %e

        return req
示例#32
0
文件: io.py 项目: whjvenyl/mist.io
    def add_key(self,
                id,
                private,
                cookie=None,
                csrf_token=None,
                api_token=None):
        payload = {'id': id, 'priv': private}
        req = MistRequests(uri=self.uri + "/keys",
                           cookie=cookie,
                           data=payload,
                           csrf_token=csrf_token,
                           api_token=api_token)

        req.get = req.unavailable_api_call
        req.post = req.unavailable_api_call
        req.delete = req.unavailable_api_call
        return req
示例#33
0
 def add_cloud(self, title, provider, apikey, apisecret, apiurl=None,
               tenant_name=None, cookie=None, csrf_token=None,
               api_token=None):
     payload = {
         'title': title,
         'provider': provider,
         'apikey': apikey,
         'apisecret': apisecret,
         'apiurl': apiurl,
         'tenant_name': tenant_name
     }
     req = MistRequests(uri=self.uri + '/clouds', data=json.dumps(payload),
                        cookie=cookie, csrf_token=csrf_token,
                        api_token=api_token)
     req.get = req.unavailable_api_call
     req.put = req.unavailable_api_call
     req.delete = req.unavailable_api_call
     return req
示例#34
0
文件: io.py 项目: carlcdavid/mist.io
    def start_machine(self, backend_id, machine_id, cookie=None,
                      csrf_token=None, api_token=None):
        # sleep(30)
        uri = self.uri + "/backends/" + backend_id + "/machines/" + machine_id
        req = MistRequests(uri=uri, data={'action': 'start'}, cookie=cookie,
                           csrf_token=csrf_token, api_token=api_token)

        req.get = req.unavailable_api_call
        req.put = req.unavailable_api_call
        req.delete = req.unavailable_api_call

        # if response.status_code == 503:
        #     print "Machine state is not yet ready to be started"
        #     return
        # assert response.ok, u'\nGot %d Response Status: %s \n%s' % (response.status_code, response.reason, response.text)
        # print "Started machine with id: %s" % machine_id

        return req
示例#35
0
    def add_backend(
        self,
        title,
        provider,
        apikey,
        apisecret,
        apiurl=None,
        tenant_name=None,
        cookie=None,
        csrf_token=None,
        api_token=None,
    ):

        payload = {
            "title": title,
            "provider": provider,
            "apikey": apikey,
            "apisecret": apisecret,
            "apiurl": apiurl,
            "tenant_name": tenant_name,
        }

        req = MistRequests(
            uri=self.uri + "/backends",
            data=json.dumps(payload),
            cookie=cookie,
            csrf_token=csrf_token,
            api_token=api_token,
        )

        req.get = req.unavailable_api_call
        req.put = req.unavailable_api_call
        req.delete = req.unavailable_api_call

        # assert response.ok, u'\nGot %d Response Status: %s \n%s' % (response
        # .status_code, response.reason, response.text)
        #
        # try:
        #     params = response.json()
        #     return params
        # except Exception as e:
        #     assert False, u'Exception: %s' % e

        return req
示例#36
0
文件: io.py 项目: carlcdavid/mist.io
    def generate_keypair(self, cookie=None, csrf_token=None, api_token=None):

        req = MistRequests(uri=self.uri + "/keys", cookie=cookie,
                           csrf_token=csrf_token, api_token=api_token)

        req.get = req.unavailable_api_call
        req.put = req.unavailable_api_call
        req.delete = req.unavailable_api_call

        # assert response.ok, u'\nGot %d Response Status: %s \n%s' % (response.status_code, response.reason, response.text)
        #
        # try:
        #     params = response.json()
        #     print params
        #     return params
        # except Exception as e:
        #     assert False, u'Exception: %s' %e

        return req
示例#37
0
    def add_key(self, name, private, cookie=None, csrf_token=None, api_token=None):
        payload = {"id": name, "priv": private}

        req = MistRequests(
            uri=self.uri + "/keys", cookie=cookie, data=payload, csrf_token=csrf_token, api_token=api_token
        )

        req.get = req.unavailable_api_call
        req.post = req.unavailable_api_call
        req.delete = req.unavailable_api_call

        # assert response.ok, u'\nGot %d Response Status: %s \n%s' % (response.status_code, response.reason, response.text)
        #
        # try:
        #     params = response.json()
        #     return params
        # except Exception as e:
        #     assert False, u'Exception: %s' %e

        return req
示例#38
0
    def supported_providers(self, cookie=None, csrf_token=None, api_token=None):

        req = MistRequests(uri=self.uri + "/providers", cookie=cookie, csrf_token=csrf_token, api_token=api_token)

        req.post = req.unavailable_api_call
        req.put = req.unavailable_api_call
        req.delete = req.unavailable_api_call
        # assert response.ok, u'\nGot %d Response Status: %s \n%s' %
        # (response.status_code, response.reason, response.text)
        #
        # try:
        #     params = response.json()
        # except Exception as e:
        #     assert False, u'Exception: %s' %e
        #
        # SUPPORTED_PROVIDERS = params['supported_providers']
        # print '\nSupported providers:'
        # return SUPPORTED_PROVIDERS

        return req
示例#39
0
    def list_images(self, backend_id, search_term=None, cookie=None, csrf_token=None, api_token=None):

        uri = (self.uri + "/backends/" + backend_id + "/images",)
        if not search_term:
            req = MistRequests(uri=uri, cookie=cookie, csrf_token=csrf_token, api_token=api_token)
            req.get = req.unavailable_api_call
        else:
            req = MistRequests(uri=uri, data={"search_term": search_term}, cookie=cookie, csrf_token=csrf_token)
            req.post = req.unavailable_api_call

        req.put = req.unavailable_api_call
        req.delete = req.unavailable_api_call

        # assert response.ok, u'\nGot %d Response Status: %s \n%s' % (response.status_code, response.reason, response.text)
        #
        # try:
        #     params = response.json()
        #     return params
        # except Exception as e:
        #     assert False, u'Exception: %s' % e

        return req
示例#40
0
文件: io.py 项目: carlcdavid/mist.io
    def supported_providers(self, cookie=None, csrf_token=None,
                            api_token=None):

        req = MistRequests(uri=self.uri + '/providers', cookie=cookie,
                           csrf_token=csrf_token, api_token=api_token)

        req.post = req.unavailable_api_call
        req.put = req.unavailable_api_call
        req.delete = req.unavailable_api_call
        # assert response.ok, u'\nGot %d Response Status: %s \n%s' %
        # (response.status_code, response.reason, response.text)
        #
        # try:
        #     params = response.json()
        # except Exception as e:
        #     assert False, u'Exception: %s' %e
        #
        # SUPPORTED_PROVIDERS = params['supported_providers']
        # print '\nSupported providers:'
        # return SUPPORTED_PROVIDERS

        return req
示例#41
0
文件: io.py 项目: whjvenyl/mist.io
    def list_images(self,
                    cloud_id,
                    search_term=None,
                    cookie=None,
                    csrf_token=None,
                    api_token=None):
        uri = self.uri + "/clouds/" + cloud_id + "/images",
        if not search_term:
            req = MistRequests(uri=uri,
                               cookie=cookie,
                               csrf_token=csrf_token,
                               api_token=api_token)
            req.get = req.unavailable_api_call
        else:
            req = MistRequests(uri=uri,
                               data={'search_term': search_term},
                               cookie=cookie,
                               csrf_token=csrf_token)
            req.post = req.unavailable_api_call

        req.put = req.unavailable_api_call
        req.delete = req.unavailable_api_call
        return req
示例#42
0
文件: io.py 项目: carlcdavid/mist.io
    def add_key(self, name, private, cookie=None, csrf_token=None,
                api_token=None):
        payload = {
            'id': name,
            'priv': private
        }

        req = MistRequests(uri=self.uri + "/keys", cookie=cookie, data=payload,
                           csrf_token=csrf_token, api_token=api_token)

        req.get = req.unavailable_api_call
        req.post = req.unavailable_api_call
        req.delete = req.unavailable_api_call

        # assert response.ok, u'\nGot %d Response Status: %s \n%s' % (response.status_code, response.reason, response.text)
        #
        # try:
        #     params = response.json()
        #     return params
        # except Exception as e:
        #     assert False, u'Exception: %s' %e

        return req
示例#43
0
文件: io.py 项目: whjvenyl/mist.io
 def supported_providers(self, api_token=None):
     req = MistRequests(uri=self.uri + '/providers', api_token=api_token)
     req.post = req.unavailable_api_call
     req.put = req.unavailable_api_call
     req.delete = req.unavailable_api_call
     return req
示例#44
0
 def supported_providers(self, api_token=None):
     req = MistRequests(uri=self.uri + '/providers', api_token=api_token)
     req.post = req.unavailable_api_call
     req.put = req.unavailable_api_call
     req.delete = req.unavailable_api_call
     return req