Skip to content

Commit

Permalink
Resolving conflicts for merge
Browse files Browse the repository at this point in the history
  • Loading branch information
amybarker committed Oct 10, 2016
2 parents 878afd0 + 563f789 commit 331b04e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 7 deletions.
22 changes: 18 additions & 4 deletions bwdata.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
bwrdata contains the BWData class.
bwdata contains the BWData class.
"""
import datetime
import filters
Expand Down Expand Up @@ -760,15 +760,29 @@ def _get_date_ranges(self, query_id=None):
return self.project.get(endpoint="queries/"+str(query_id)+"/"+"date-range")

def _fill_params(self, name, startDate, data):
try:
int(name)
numerical = True
except ValueError:
numerical = False

if not name:
raise KeyError("Must specify query or group name", data)
elif name not in self.ids:
raise KeyError("Could not find " + self.resource_type + " " + name, self.ids)
elif numerical:
if int(name) not in self.ids.values():
raise KeyError("Could not find " + self.resource_type + " " + name, self.ids)
elif not numerical:
if name not in self.ids:
raise KeyError("Could not find " + self.resource_type + " " + name, self.ids)
if not startDate:
raise KeyError("Must provide start date", data)

filled = {}
filled[self.resource_id_name] = self.ids[name]
if numerical:
filled[self.resource_id_name] = name
else:
filled[self.resource_id_name] = name

filled["startDate"] = startDate
filled["endDate"] = data["endDate"] if "endDate" in data else (
datetime.date.today() + datetime.timedelta(days=1)).isoformat()
Expand Down
17 changes: 15 additions & 2 deletions bwproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,22 @@ def get_project(self, project):
projects = self.get_projects()
project_found = False

try:
int(project)
numerical = True
except:
numerical = False

for p in projects:
if p["name"] == project:
self.project_name = project
found = False
if numerical:
if p["id"] == int(project):
found = True
else:
if p["name"] == project:
found = True
if found:
self.project_name = p["name"]
self.project_id = p["id"]
self.project_address = "projects/" + str(self.project_id) + "/"
project_found = True
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setup(
name='bwapi',

version='1.0.8',
version='1.0.9',

description='A software development kit for the Brandwatch API',

Expand Down

0 comments on commit 331b04e

Please sign in to comment.