GithubHelp home page GithubHelp logo

api_sdk's People

Contributors

amybarker avatar anthonybu avatar b-0-b avatar bainzo avatar bw-matthew avatar calumstoreydavidson avatar felixgb avatar hamishmorgan avatar jamiel1 avatar johnmbw avatar jstanier avatar miraliu avatar nahianj avatar pfairfax1 avatar pwsiegel avatar spmason avatar sullivancolin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

api_sdk's Issues

Duplicates in bulk mentions downloads

The list of mentions returned by BWMentionsResources.get_mentions() may contain duplicates if new mentions are added during multi-page calls. Perhaps the best solution is to implement paging by modifying end dates rather than using the API's native paging support.

Allowing lists of startDates in "get_mentions"

I was wondering whether it would be possible of having the option to feed in a list of start dates (and potentially end dates) in to a "get_mentions" call.

As I understood, at the moment I can feed in a list of names but they will all have the same start and end date. For the task I am trying to achieve each query would have a different start date.

For now I will use a loop for each query but was wondering whether the performance would be better when submitting fewer requests.

pypi still at 1.1.2

at least on backwards compatability issue between github v and pypi v:

.num_mentions returns dict in 1.2.2
.num_mentions returns int in 1.1.2

Add a rename() method

Add a rename() method in BWResources and remove the new_name handling in each subclass's _fill_data() mehod.

Extract data from group

Hello,

I went through the DEMO and I thought I could download all queries in a group, but in practice I got this error:
('No valid queries ids could be extracted', 'MyGroup')

In bwresources.py, it says:
def get_mention(self, **kwargs): Retrieves a single mention by url or resource id. This is ONLY a valid function for queries (not groups), which is why it isn't split out into bwdata.

Well, is there a way to download the data from all queries in a group in one call? Or at least interact with a list of queries?

Thanks!

username with capital letters

I came across an issue when I use the token_path instead of the password to request my project:
BWProject(username=YOUR_ACCOUNT, project=YOUR_PROJECT)

When at the beginning I used my username and password, the tokens.txt was generated with the username in lowercase (_read_auth_file).
On the other hand, my username contains capital letters, meaning my user´s json will be returned with these capital letters in the username field, so the _test_auth() method will fail in bwproject.py.

I can think of ways to get around it by making it case sensitive, but I would appreciate some suggestions.

Many thanks in advance!

from authenticate import authenticate

Hello,
I installed the bwapi package in my Python3 environment. Example:

(bw) alexis@linux:~/brandwatch$ pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
bwapi (3.2.0)
certifi (2018.11.29)
chardet (3.0.4)
idna (2.8)
pip (9.0.1)
pkg-resources (0.0.0)
requests (2.21.0)
setuptools (39.0.1)
urllib3 (1.24.1)

However, when I run the following code coming from DEMO.ipynb it tells me that I am missing the package authenticate.

(bw) alexis@linux:~/brandwatch$ python3
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from authenticate import authenticate
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'authenticate'

Could you please tell me what am I missing?
Thanks

Alexis

no attribute in get_mention_page

I am getting the following error when using the function get_mentions from the BWQueries class in v.1.0.6:

line 181, in get_mentions next_mentions = self.get_mentions_page(params, 0) AttributeError: 'BWQueries' object has no attribute 'get_mentions_page'

I couldn't quite figure out what causes the error but when I used the previous version of bwresources.py (that has been updated on 5. July by @pwsiegel) it works.

I am using the simplest "get_mentions" call (only name, startDate, EndDate and no filters).

Does the parameter: Exclude Category can be used in the API?

In the DashBoard UI, we can easy to filter the categories by using the field: Filter By Category and Exclude Category , but in the example for API, i can see only parentCategory and Category (maybe they are representing for the field: Filter By Category). Where can i put Exclude Category in the API?
Thanks

BWProjects should take a BWUser instance

This logic centralizes authentication in the BWUser class, and mimics the lookup logic of other classes in BWQueries, etc.

Concretely improves the workflow for users that want to created a BWUser instance and access multiple projects in a single session.

Modify how tokens are passed in API calls

API tokens should be passed in the HTTP header rather than as URL params. In theory this should just involve modifying BWUser.bare_request() in a fairly trivial way.

Bug in chart calls which break down by specific tags

Consider a call of the form

BWQueries().get_chart(name='My Query', startDate='YYYY-MM-DD', x_axis='days', y_axis='volume', breakdown_by='tags', dim2Args=['first_tag, 'second_tag'])

The SDK makes a call which looks like:

https://api.brandwatch.com/projects/<project id>/data/volume/days/tags?queryId=<query id>&startDate=YYYY-MM-DD&endDate=YYYY-MM-DD&dim2Args=<tag id>&dim2Args=<tag id>&access_token=<token>

But this returns a response with all data and values fields empty. The reason is that the API expects tag names instead of tag id's; the following call gives the desired result:

https://api.brandwatch.com/projects/<project id>/data/volume/days/tags?queryId=<query id>&startDate=YYYY-MM-DD&endDate=YYYY-MM-DD&dim2Args=first_tag&dim2Args=second_tag&access_token=<token>

I think the same issue came up when formulating get_mentions requests with tag filters; for some mysterious reason the API expects category ID's but tag names. 🤷‍♂️

"Search Within" Filter

Add ability to filter mentions call by a boolean string. Warning: test first to ensure that it doesn't put too much strain on the system (i.e. test extra time it takes)

filter zero value when retrieve dimension data

Hello,

I have the question when calling the API the JSON including the data which the value is zero or negative for some dimensions. For example, when I use the below endpoint to retrieve the aggregated data.
https://api.brandwatch.com/projects/xxxxxx/data/forumPosts/languages/days?queryId=111&startDate=2019-10-04&endDate=2019-10-05
Please see the example JSON data, the value is zero.
{"dimension1":"languages","dimension2":"days","aggregate":"forumPosts","results":[{"id":"en","name":"English","data":{},"values":[{"id":"2019-10-04T00:00:00.000+0000","name":"2019-10-04 00:00:00.0","data":{},"value":0}]}]}

Is it possible to filter the zero and negative values with some parameters?

Thank you,
Yonghe

Backfill_date not getting updated: upload_all

I am trying to update the Search Terms for multiple existing Query Names in one of my project using the SDK in Python. When I use the upload() or upload_all() from BWQueries the search terms get updated but the baclfill_date is not getting updated.

I am setting below values:

query_list = list({'name': 'CONVERSEON-TEST-SDK', 'includedTerms': 'author:(
770002)', 'backfill_date': '2017-07-01'},
{'name': 'CONVERSEON-TEST-SDK2', 'includedTerms': 'author:(318808889
OR 319990802)', 'backfill_date': '2017-07-01'})
queries.upload_all(query_list)

If I go into the BWResource class and log the response of upload_all(), it shows me that it has updated: ‘unlimitedHistoricalData’: {‘backfillMinDate’: ‘2017-07-01T00:00:00.000+0000’, ‘unlimitedHistoricalDataEnabled’: False}}

But in the frontend it always says August. Below is the screenshot:
bw_sdk_upload_all_screenshot 2017-09-20

Queries with commas

Right now we parse queries by where there is a comma - but what if the query name has a comma in it?

Support `application-become` grant type

Let's add support for the "become" functionality in the API:

params = {
    "username": other_user,
    "grant_type": "application-become",
    "client_id": "brandwatch-application-client",
}

at = requests.post("http://newapi.brandwatch.com/oauth/token/?access_token=" + bw_admin_token, params=params)

token_for_client_account = at.json()['access_token’]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.