def test_put(self): response = unirest.put('http://httpbin.org/put', params={"name":"Mark", "nick":"thefosk"}) self.assertEqual(response.code, 200) self.assertEqual(len(response.body['args']), 0) self.assertEqual(len(response.body['form']), 2) self.assertEqual(response.body['form']['name'], "Mark") self.assertEqual(response.body['form']['nick'], "thefosk")
def PutData(isbnurls): """ data """ spidername = 'ShaishufangAmazon' cnt = 0 for url in isbnurls: print cnt, '-->', url cnt += 1 unirest.timeout(180) response = unirest.get(url, headers={"Accept":"application/json"}) # handle url = baseurl + isbn try: #bookdt bookdt = response.body['isbn'] bookdt['spider'] = spidername #data style datadict = {} datadict['datas'] = [bookdt] #put datadict unirest.timeout(180) resdata = unirest.put( "http://192.168.100.3:5000/data", headers={ "Accept": "application/json", "Content-Type": "application/json" }, params=json.dumps(datadict) ) except: pass if ((cnt%80)==0): time.sleep(3)
def putUpdateCustomers(self, ): ''' Update one or more objects :returns: response from the API call :rType: CustomersModel ''' #prepare query string for API call queryBuilder = Configuration.BASEURI + "/Customers" #validate and preprocess url queryUrl = APIHelper.cleanUrl(queryBuilder) #prepare headers headers = { "User-Agent": "APIMATIC 2.0", "Accept": "application/json", } #prepare and invoke the API call request to fetch the response response = unirest.put(queryUrl, headers=headers) #Error handling using HTTP status codes if response.code < 200 and response.code > 206: #200 = HTTP OK raise APIException("HTTP Response Not OK", response.code) return response.body
def test_put(self): response = unirest.put("http://httpbin.org/put", params={"name": "Mark", "nick": "thefosk"}) self.assertEqual(response.code, 200) self.assertEqual(len(response.body["args"]), 0) self.assertEqual(len(response.body["form"]), 2) self.assertEqual(response.body["form"]["name"], "Mark") self.assertEqual(response.body["form"]["nick"], "thefosk")
def putUpdateCustomers(self,): ''' Update one or more objects :returns: response from the API call :rType: CustomersModel ''' #prepare query string for API call queryBuilder = Configuration.BASEURI + "/Customers" #validate and preprocess url queryUrl = APIHelper.cleanUrl(queryBuilder) #prepare headers headers = { "User-Agent" : "APIMATIC 2.0", "Accept" : "application/json", } #prepare and invoke the API call request to fetch the response response = unirest.put(queryUrl, headers=headers) #Error handling using HTTP status codes if response.code < 200 and response.code > 206: #200 = HTTP OK raise APIException("HTTP Response Not OK", response.code) return response.body
def index(fid): print "THIS IS A TEST" #process submission first = request.args.get('first') second = request.args.get('second') third = request.args.get('third') if bool(first) or bool(second) or bool(third): review = '' if bool(first): review += "How awesome was your tour guide?\n\n" review += first + '\n\n' if bool(second): review += "Was there anything you would have liked to have heard about, but didn't?\n\n" review += second + '\n\n' if bool(third): review += "Was there anything you could have done without?\n\n" review += third print review params = {'review': review} response = unirest.put(os.environ['CLERK_URL'], params=params) print response.body return "Submitted" #serve form try: data = {'id': fid} data['name'] = get(data['id'])['name'] return render_template('followup.html', data=data) except TypeError: return render_template('index.html', data=data)
def setNewLightState(lightId, newState): url = bridgeUrl + userId + "/lights/" + str(lightId) + "/state" response = unirest.put(url, headers={ "Accept": "application/json" }, params=json.dumps({ "on": newState, "bri": 254 }) )
def putUnvisitedUrls(data): url = 'http://127.0.0.1:5000/unvisitedurls' unirest.timeout(180) # time out 180 same with scrapy download middlewares res = unirest.put(url, headers=Headers, params=json.dumps(data)) if res.body['code'] != 200: return False return len(res.body['data'])
def putDeadUrls(data): url = BaseUrl + 'deadurls' unirest.timeout(180) # time out 180 same with scrapy download middlewares res = unirest.put(url, headers=Headers, params=json.dumps(data)) if res.body['code'] != 200: return False return True
def execute(mthd, url, body_data=None): try: access_token = 'sq0atb-_ifJWXh-Jj15F004mRfJ6Q' #os.environ['SQUARE_ACCESS_TOKEN'] except KeyError: raise Exception("Set the server environment variable SQUARE_ACCESS_TOKEN to that of your Square account.") if mthd == "GET": response = unirest.get(url, headers={ "Authorization": "Bearer "+access_token, "Accept": "application/json" }) elif mthd == "POST": response = unirest.post(url, headers={ "Authorization": "Bearer "+access_token, "Accept": "application/json", "Content-Type": "application/json" }, params=body_data) elif mthd == "PUT": response = unirest.put(url, headers={ "Authorization": "Bearer "+access_token, "Accept": "application/json", "Content-Type": "application/json" }, params=body_data) elif mthd == "DELETE": response = unirest.delete(url, headers={ "Authorization": "Bearer "+access_token, "Accept": "application/json" }) return response.body
def starring(): if request.method == 'POST': access_token = request.form['accessToken'] repo = request.form['repo'] if access_token and not access_token.isspace() and repo and not repo.isspace(): response = unirest.put('https://api.github.com/user/starred/' + repo + '?access_token=' + access_token, headers={'Accept': 'application/json', 'User-Agent': 'All-Star'}) if response.code == 204: return '200' else: return '500' else: return 'Error Parameter' else: return 'Unsupported request method'
def cancel_invite(access_token, document_id): """Cancel all invites on a document. Args: access_token (str): The access token for the user account that has access to the document. document_id (str): The unique id of the document you want to cancel all invites for. Returns: dict: The JSON response from the API {u'result': u'success'} or JSON representing an API error. """ response = put(Config().get_base_url() + '/document/' + document_id + '/fieldinvitecancel', headers={ "Authorization": "Bearer " + access_token, "Accept": "application/json", }) return response.body
def update_occurrence_download_put_update_status(self, key): """Does a PUT request to /occurrence/download/{key}. Updates the status of an existing occurrence download. This operation can be executed by the role ADMIN only. Args: key (string): Updates the status of an existing occurrence download. Returns: void: Response from the API. Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ # The base uri for api requests query_builder = Configuration.BASE_URI # Prepare query string for API call query_builder += "/occurrence/download/{key}" # Process optional template parameters query_builder = APIHelper.append_url_with_template_parameters(query_builder, { "key": key }) # Validate and preprocess url query_url = APIHelper.clean_url(query_builder) # Prepare headers headers = { "user-agent": "APIMATIC 2.0" } # Prepare and invoke the API call request to fetch the response response = unirest.put(query_url, headers=headers, params={}, auth=(self.__user, self.__password)) # Error handling using HTTP status codes if response.code < 200 or response.code > 206: # 200 = HTTP OK raise APIException("HTTP Response Not OK", response.code, response.body)
def parse(self, response): logging.info(response.status) if response.status == 200: logging.info('Status code: ' + str(response.status)) else: url = 'http://192.168.100.3:5000/deadurls' headers = { 'Accept': 'application/json', "Content-Type": "application/json" } params = { "urls": [ {"url": response.url, "spider": self.name} ] } res = unirest.put(url, headers=headers, params=json.dumps(params)) if res.body['code'] == 200: logging.info("Dead Inserted: " + json.dumps(params))
def add_chain_to_wallet(self): """Does a PUT request to /api. TODO: type endpoint description here. Returns: SuccessModel: Response from the API. Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ # The base uri for api requests query_builder = Configuration.BASE_URI # Prepare query string for API call query_builder += "/api" # Validate and preprocess url query_url = APIHelper.clean_url(query_builder) # Prepare headers headers = { "user-agent": "APIMATIC 2.0", "accept": "application/json" } # Prepare and invoke the API call request to fetch the response response = unirest.put(query_url, headers=headers) # Error handling using HTTP status codes if response.code < 200 or response.code > 206: # 200 = HTTP OK raise APIException("HTTP Response Not OK", response.code, response.body) # Try to cast response to desired type if isinstance(response.body, dict): # Response is already in a dictionary, return the object return Success(**response.body) # If we got here then an error occured while trying to parse the response raise APIException("Invalid JSON returned", response.code, response.body)
def push_daily_service_monitoring_rate(service_list): response = unirest.post( "https://push.ducksboard.com/v/782", #enter ducksboard widget push api url headers={"Accept": "application/json", "Content-Type": "application/json"}, params=json.dumps({ "value": service_list[1][0] }), auth=(ducksboard_key, "")) response = unirest.post( "https://push.ducksboard.com/v/482375", #enter ducksboard widget push api url headers={"Accept": "application/json", "Content-Type": "application/json"}, params=json.dumps({ "value": service_list[1][1] }), auth=(ducksboard_key, "")) response = unirest.post( "https://push.ducksboard.com/v/482376", #enter ducksboard widget push api url headers={"Accept": "application/json", "Content-Type": "application/json"}, params=json.dumps({ "value": service_list[1][2] }), auth=(ducksboard_key, "")) response = unirest.post( "https://push.ducksboard.com/v/482377", #enter ducksboard widget push api url headers={"Accept": "application/json", "Content-Type": "application/json"}, params=json.dumps({ "value": service_list[1][3] }), auth=(ducksboard_key, "")) #renames values for bar charts dynamically response = unirest.put( "https://app.ducksboard.com/api/widgets/389222", #enter ducksboard widget push api url headers={"Accept": "application/json", "Content-Type": "application/json"}, params=json.dumps({"widget":{}, "slots":{"1": {"subtitle" : service_list[0][0]}, "2": {"subtitle" : service_list[0][1]}, "3": {"subtitle" : service_list[0][2]}, "4": {"subtitle" : service_list[0][3]} }}), auth=(ducksboard_key, ""))
def update(access_token, document_id, data_payload): """Update a document with fields, texts, and check marks. Args: access_token (str): The access token for the user account that has access to the document. document_id (str): The unique id of the document you want to update. data_payload (dict): A dictionary representing the data payload passed in the request body. See the API documention on how to consstruct it https://campus.barracuda.com/product/signnow/article/CudaSign/RestEndpointsAPI/ Returns: dict: The JSON response from the API which includes the document id and arrays of elements added to the document """ response = put(Config().get_base_url() + '/document/' + document_id, headers={ "Authorization": "Bearer " + access_token, "Content-Type": "application/json", "Accept": "application/json" }, params=dumps(data_payload)) return response.body
def putUpdateOneCustomers(self, pk): ''' Update one object :param pk: Required CustomerID :type pk: string :returns: response from the API call :rType: CustomersModel ''' #prepare query string for API call queryBuilder = Configuration.BASEURI + "/Customers/{pk}" #process optional query parameters queryBuilder = APIHelper.appendUrlWithTemplateParameters(queryBuilder, { "pk": pk , }) #validate and preprocess url queryUrl = APIHelper.cleanUrl(queryBuilder) #prepare headers headers = { "User-Agent" : "APIMATIC 2.0", "Accept" : "application/json", } #prepare and invoke the API call request to fetch the response response = unirest.put(queryUrl, headers=headers) #Error handling using HTTP status codes if response.code < 200 and response.code > 206: #200 = HTTP OK raise APIException("HTTP Response Not OK", response.code) return response.body
def putUpdateOneCustomers(self, pk): ''' Update one object :param pk: Required CustomerID :type pk: string :returns: response from the API call :rType: CustomersModel ''' #prepare query string for API call queryBuilder = Configuration.BASEURI + "/Customers/{pk}" #process optional query parameters queryBuilder = APIHelper.appendUrlWithTemplateParameters( queryBuilder, { "pk": pk, }) #validate and preprocess url queryUrl = APIHelper.cleanUrl(queryBuilder) #prepare headers headers = { "User-Agent": "APIMATIC 2.0", "Accept": "application/json", } #prepare and invoke the API call request to fetch the response response = unirest.put(queryUrl, headers=headers) #Error handling using HTTP status codes if response.code < 200 and response.code > 206: #200 = HTTP OK raise APIException("HTTP Response Not OK", response.code) return response.body
#!/usr/bin/env python # coding=utf8 # # Author: Archer Reilly # File: UnirestFileUpload.py # Desc: upload a image file to the api # Date: 16/Apr/2016 # # Produced By BR import unirest import os url = 'http://192.168.100.2:8090/cutbook' files = os.listdir('../data/img') for img in files: print img params = { "file": open('../data/img/' + img, mode='r') } response = unirest.put(url, params=params) print response
def put(self, id, dados): res = unirest.put(self.__monta_url(id), headers=self.__monta_headers(), params=json.dumps(dados)) return self.__monta_retorno(res)
def spider_closed(self, spider): """ Put visitedurldict, datadict, filedict, deadurldict to Master. Format: visitedurldict['urls'] = [ {'url':'', 'spider':self.name}, {'url':'', 'spider':self.name} ] datadict['datas'] = [ {'url':'', 'data':{}, 'spider':self.name}, {'url':'', 'data':{}, 'spider':self.name} ] filedict['files'] = [ {'url':'', 'head':'', 'body':'', 'spider':self.name}, {'url':'', 'head':'', 'body':'', 'spider':self.name} ] deadurldict['urls'] = [ {'url':'', 'spider':self.name}, {'url':'', 'spider':self.name} ] """ lenOfdeadUrls = len(self.deadurldict['urls']) logging.info('spidername ' + self.name + '!!!') logging.info('visitedurls' + str(len(self.visitedurldict['urls']))) logging.info('datadict ' + str(len(self.datadict['datas']))) logging.info('filedict ' + str(len(self.filedict['files']))) logging.info('deadurls ' + str(len(self.deadurldict['urls']))) if (lenOfdeadUrls==10): unirest.timeout(180) resdeadurl = unirest.put( "http://192.168.100.3:5000/deadurls", headers={ "Accept": "application/json", "Content-Type": "application/json" }, params=json.dumps(self.deadurldict) ) elif(lenOfdeadUrls==0): unirest.timeout(180) resvisitedurl = unirest.put( "http://192.168.100.3:5000/visitedurls", headers={ "Accept": "application/json", "Content-Type": "application/json" }, params=json.dumps(self.visitedurldict) ) unirest.timeout(180) resdata = unirest.put( "http://192.168.100.3:5000/data", headers={ "Accept": "application/json", "Content-Type": "application/json" }, params=json.dumps(self.datadict) ) unirest.timeout(180) resfile = unirest.put( "http://192.168.100.3:5000/file", headers={ "Accept": "application/json", "Content-Type": "application/json" }, params=json.dumps(self.filedict) ) else:# lenOfdeadUrls in (0,10) unirest.timeout(180) resvisitedurl = unirest.put( "http://192.168.100.3:5000/visitedurls", headers={ "Accept": "application/json", "Content-Type": "application/json" }, params=json.dumps(self.visitedurldict) ) unirest.timeout(180) resdata = unirest.put( "http://192.168.100.3:5000/data", headers={ "Accept": "application/json", "Content-Type": "application/json" }, params=json.dumps(self.datadict) ) unirest.timeout(180) resfile = unirest.put( "http://192.168.100.3:5000/file", headers={ "Accept": "application/json", "Content-Type": "application/json" }, params=json.dumps(self.filedict) ) unirest.timeout(180) resdeadurl = unirest.put( "http://192.168.100.3:5000/deadurls", headers={ "Accept": "application/json", "Content-Type": "application/json" }, params=json.dumps(self.deadurldict) )
import unirest import json if (__name__=='__main__'): #!< amazonURL.json with open('./amazonURL.json', 'rb') as f5: uvdict = json.load(f5) f5.close() uvlist = uvdict['urls'] print len(uvlist), uvlist[0] unirest.timeout(180) resunvisitedurl = unirest.put( "http://192.168.100.3:5000/unvisitedurls", headers={ "Accept": "application/json", "Content-Type": "application/json" }, params=json.dumps(uvdict) )
def spider_closed(self, spider): """ Put visitedurldict, datadict, filedict, deadurldict to Master. Format: visitedurldict['urls'] = [ {'url':'', 'spider':'douban'}, {'url':'', 'spider':'douban} ] datadict['datas'] = [ {'url':'', 'data':{}, 'spider':'douban'}, {'url':'', 'data':{}, 'spider':'douban} ] filedict['files'] = [ {'url':'', 'head':'', 'body':'', 'spider':'douban'}, {'url':'', 'head':'', 'body':'', 'spider':'douban} ] deadurldict['urls'] = [ {'url':'', 'spider':'douban'}, {'url':'', 'spider':'douban} ] """ #scrapy crawl douban -a url='http://192.168.100.3:5000/unvisitedurls?start=0&offset=10&spider=douban' lenOfdeadUrls = len(self.deadurldict['urls']) logging.info('spider name:' + self.name ) logging.info('visitedurls:' + str(len(self.visitedurldict['urls'])) ) logging.info('datadict :' + str(len(self.datadict['datas'])) ) logging.info('filedict :' + str(len(self.filedict['files'])) ) logging.info('deadurls :' + str(len(self.deadurldict['urls'])) ) if (lenOfdeadUrls==10): unirest.timeout(180) resdeadurl = unirest.put( "http://192.168.100.3:5000/deadurls", headers={ "Accept": "application/json", "Content-Type": "application/json" }, params=json.dumps(self.deadurldict) ) elif(lenOfdeadUrls==0): unirest.timeout(180) resvisitedurl = unirest.put( "http://192.168.100.3:5000/visitedurls", headers={ "Accept": "application/json", "Content-Type": "application/json" }, params=json.dumps(self.visitedurldict) ) unirest.timeout(180) resdata = unirest.put( "http://192.168.100.3:5000/data", headers={ "Accept": "application/json", "Content-Type": "application/json" }, params=json.dumps(self.datadict) ) unirest.timeout(180) resfile = unirest.put( "http://192.168.100.3:5000/file", headers={ "Accept": "application/json", "Content-Type": "application/json" }, params=json.dumps(self.filedict) ) else:# lenOfdeadUrls in (0,10) unirest.timeout(180) resvisitedurl = unirest.put( "http://192.168.100.3:5000/visitedurls", headers={ "Accept": "application/json", "Content-Type": "application/json" }, params=json.dumps(self.visitedurldict) ) unirest.timeout(180) resdata = unirest.put( "http://192.168.100.3:5000/data", headers={ "Accept": "application/json", "Content-Type": "application/json" }, params=json.dumps(self.datadict) ) unirest.timeout(180) resfile = unirest.put( "http://192.168.100.3:5000/file", headers={ "Accept": "application/json", "Content-Type": "application/json" }, params=json.dumps(self.filedict) ) unirest.timeout(180) resdeadurl = unirest.put( "http://192.168.100.3:5000/deadurls", headers={ "Accept": "application/json", "Content-Type": "application/json" }, params=json.dumps(self.deadurldict) )
def push_daily_service_monitoring_rate(service_list): response = unirest.post( "https://push.ducksboard.com/v/782", #enter ducksboard widget push api url headers={ "Accept": "application/json", "Content-Type": "application/json" }, params=json.dumps({"value": service_list[1][0]}), auth=(ducksboard_key, "")) response = unirest.post( "https://push.ducksboard.com/v/482375", #enter ducksboard widget push api url headers={ "Accept": "application/json", "Content-Type": "application/json" }, params=json.dumps({"value": service_list[1][1]}), auth=(ducksboard_key, "")) response = unirest.post( "https://push.ducksboard.com/v/482376", #enter ducksboard widget push api url headers={ "Accept": "application/json", "Content-Type": "application/json" }, params=json.dumps({"value": service_list[1][2]}), auth=(ducksboard_key, "")) response = unirest.post( "https://push.ducksboard.com/v/482377", #enter ducksboard widget push api url headers={ "Accept": "application/json", "Content-Type": "application/json" }, params=json.dumps({"value": service_list[1][3]}), auth=(ducksboard_key, "")) #renames values for bar charts dynamically response = unirest.put( "https://app.ducksboard.com/api/widgets/389222", #enter ducksboard widget push api url headers={ "Accept": "application/json", "Content-Type": "application/json" }, params=json.dumps({ "widget": {}, "slots": { "1": { "subtitle": service_list[0][0] }, "2": { "subtitle": service_list[0][1] }, "3": { "subtitle": service_list[0][2] }, "4": { "subtitle": service_list[0][3] } } }), auth=(ducksboard_key, ""))
#!/usr/bin/env python # coding=utf8 # # Author: Archer Reilly # File: UnirestFileUpload.py # Desc: upload a image file to the api # Date: 16/Apr/2016 # # Produced By BR import unirest import os url = 'http://192.168.100.2:8090/cutbook' files = os.listdir('../data/img') for img in files: print img params = {"file": open('../data/img/' + img, mode='r')} response = unirest.put(url, params=params) print response
def updateWebhook(accountId, apiToken, webhookId, dataParams): response = unirest.put("%s%s/webhooks/%s" % (url, accountId, webhookId), headers={"Content-Type": "application/json"}, params=dataParams, auth=('', apiToken)) print response.raw_body
def appendCustomAuthParams(method='GET', query_url=Configuration.BASE_URI, body='', headers={}): """ Appends the necessary OAuth credentials for making this authorized call :param method: The outgoing request method :type string: GET, PUT, PATCH, POST, DELETE :param query_url: URL to make the request to :type string: :param body: request payload :type string: :param headers: The out going request to access the resource :type dict: Header dictionary """ timestamp = dt.datetime.utcnow().replace(microsecond=0).isoformat() headers['X-Timestamp'] = timestamp body_hash = "" if body: # TODO: implement conditions for body transposing into a md5 hash # and accommodate for handling form data body_hash = hashlib.md5(body).hexdigest() if body != '' else '' parsed_url = urlparse(query_url) qpd = dict(parse_qsl(parsed_url.query)) qp = sorted(qpd.items()) ordered_qp = urlencode(qp) canonical_uri = '{0}://{1}{2}\n{3}'.format(parsed_url.scheme, parsed_url.netloc, parsed_url.path, ordered_qp) tokens = (timestamp, method, body_hash, canonical_uri) message_string = u'\n'.join(tokens).encode('utf-8') signature = hmac.new(Configuration.password, message_string, digestmod=hashlib.sha1).hexdigest() url = canonical_uri.replace('\n', '?') response = '' if method == 'GET': response = unirest.get(url, auth=(Configuration.username, signature), headers=headers, params=body) elif method == 'PUT': response = unirest.put(url, auth=(Configuration.username, signature), headers=headers, params=body) elif method == 'POST': response = unirest.post(url, auth=(Configuration.username, signature), headers=headers, params=body) elif method == 'PATCH': response = unirest.patch(url, auth=(Configuration.username, signature), headers=headers, params=body) elif method == 'DELETE': response = unirest.delete(url, auth=(Configuration.username, signature), headers=headers, params=body) else: raise ValueError('Invalid HTTP Method was used.') return response
auth=(ducksboard_key, "")) response = unirest.post( "https://push.ducksboard.com/v/499413", headers={"Accept": "application/json", "Content-Type": "application/json"}, params=json.dumps({ "value": os_list[1][3], "timestamp": start_time }), auth=(ducksboard_key, "")) response = unirest.put( "https://app.ducksboard.com/api/widgets/400402", headers={"Accept": "application/json", "Content-Type": "application/json"}, params=json.dumps({"widget":{}, "slots":{"1": {"subtitle" : os_list[0][0]}, "2": {"subtitle" : os_list[0][1]}, "3": {"subtitle" : os_list[0][2]}, "4": {"subtitle" : os_list[0][3]} }}), auth=(ducksboard_key, "")) def main(): #updates daily app loads appLoads = fetch_daily_appLoads(access_token, appId) if appLoads is not None: push_daily_appLoads(appLoads) time.sleep(1) #updates daily active users dau = fetch_daily_active_users(access_token, appId) if dau is not None:
print 'Delete a replica set' print '%s\n%s\n%s' % (response.code, response.headers, response.body) # Replace Replica Set. print 'Replace a replica set' response = unirest.post("http://localhost:" + REST_PORT + "/replicaset/-4727115044472165798", headers={ "Accept": "application/json" }, params={"iStudyInstanceUID" : "1.3.6.1.4.1.14519.5.2.1.4591.4001.151679082681232740021018262895", "iSeriesInstanceUID" : "1.3.6.1.4.1.14519.5.2.1.4591.4001.179004339156422100336233996679" }) print '%s\n%s\n%s' % (response.code, response.headers, response.body) # Append Replica Set. response = unirest.put("http://localhost:" + REST_PORT + "/replicaset/-4727115044472165798", headers={ "Accept": "application/json" }, params={"iCollection" : "TCGA-GBM"}) print 'Append a replica set' print '%s\n%s\n%s' % (response.code, response.headers, response.body) # Duplicate Replica Set. response = unirest.post("http://localhost:" + REST_PORT + "/replicaset", headers={ "Accept": "application/json" }, params={ "userID" : "1234567", "replicaSetID": "-4727115044472165798"}) print 'Duplicate a replica set' print '%s\n%s\n%s' % (response.code, response.headers, response.body) # Retrieve the users. response = unirest.get("http://localhost:" + REST_PORT + "/")
"timestamp": start_time }), auth=(ducksboard_key, "")) response = unirest.put("https://app.ducksboard.com/api/widgets/400402", headers={ "Accept": "application/json", "Content-Type": "application/json" }, params=json.dumps({ "widget": {}, "slots": { "1": { "subtitle": os_list[0][0] }, "2": { "subtitle": os_list[0][1] }, "3": { "subtitle": os_list[0][2] }, "4": { "subtitle": os_list[0][3] } } }), auth=(ducksboard_key, "")) def main(): #updates daily app loads