BrandwatchLtd / bcr-api

Python Client Library for the Brandwatch Consumer Research API
MIT License
21 stars 24 forks source link

Invalid field "monitorSamplePercentage" for Query upload #11

Closed Miraliu closed 4 years ago

Miraliu commented 4 years ago

Maybe the field is removed in BCR? The upload method seems to work after commenting out this line: https://github.com/BrandwatchLtd/bcr-api/blob/05ece054a0959acf62737e5a1f42ef485033b825/src/bcr_api/bwresources.py#L487

pfairfax1 commented 4 years ago

Hi @Miraliu , thanks for raising - we are aware of the issue and are working on a fix

christophajohns commented 4 years ago

Hi @pfairfax1, are there any updates on when this will be fixed? Maybe it is just a typo and should be samplePercentage instead: https://developers.brandwatch.com/docs/creating-queries

christophajohns commented 4 years ago

I tried to upload a group with queries using samplePercentage instead of monitorSamplePercentage but get this error:

12:12:47 DEBUG: https://api.brandwatch.com/projects/1998292456/queries
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
 in 
      ...

~/Projects/bcr-test/bcr_api/bwresources.py in upload_queries_as_group(self, group_name, query_data_list, create_only, modify_only, **kwargs)
    590         """
    591         kwargs["queries"] = self.queries.upload_all(
--> 592             query_data_list, create_only, modify_only
    593         )
    594         kwargs["name"] = group_name

~/Projects/bcr-test/bcr_api/bwresources.py in upload_all(self, data_list, create_only, modify_only)
    310 
    311         queries = super(BWQueries, self).upload_all(
--> 312             data_list, create_only=False, modify_only=False
    313         )
    314 

~/Projects/bcr-test/bcr_api/bwresources.py in upload_all(self, data_list, create_only, modify_only)
    178                 continue
    179 
--> 180             logger.info("Uploading {} {}".format(self.resource_type, response["name"]))
    181             resources[response["name"]] = response["id"]
    182 

KeyError: 'name'
pfairfax1 commented 4 years ago

Hi @christophajohns, apologies for the delay. We will be releasing a fix ASAP

pfairfax1 commented 4 years ago

Hi, @christophajohns @Miraliu we've released the fix now. You can now do queries.upload(). We might need to make some further changes around sampling in the near future.