Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make some Python API methods compatible with coming Mixer API changes. #116

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mvashishtha
Copy link

We are going to change the places-in, population, and observation mixer API methods
so that they return maps from dcid to lists of dcids, population dcids, and
observation values respectively. Update the corresponding Python API methods so
that they work with both the new and old Mixer API versions.

We are going to change the places-in, population, and observation mixer API methods
so that they return maps from dcid to lists of dcids, population dcids, and
observation values respectively. Update the corresponding Python API methods so
that they work with both the new and old Mixer API versions.
Copy link
Contributor

@shifucun shifucun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the change! looks much better now.

])
res_json =json.dumps({
'geoId/06085': 'dc/p/crgfn8blpvl35',
'geoId/4805000': 'dc/p/f3q9whmjwbf36'}) if kwargs['new_mixer_api'] else json.dumps([
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might use a normal if else outside

@@ -103,7 +106,7 @@ def read(self):
and data['measurement_method'] == 'BLSSeasonallyAdjusted':
if data['dcids'] == ['dc/p/x6t44d8jd95rd', 'dc/p/lr52m1yr46r44', 'dc/p/fs929fynprzs']:
# Response returned when querying for multiple valid dcids.
res_json = json.dumps([
res_json = json.dumps({'dc/p/x6t44d8jd95rd': '18704962.000000', 'dc/p/lr52m1yr46r44': '3075662.000000', 'dc/p/fs929fynprzs': '1973955.000000'}) if kwargs['new_mixer_api'] else json.dumps([
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try to conform to line 80

@@ -120,7 +123,7 @@ def read(self):
return MockResponse(json.dumps({'payload': res_json}))
if data['dcids'] == ['dc/p/x6t44d8jd95rd', 'dc/MadDcid']:
# Response returned when querying for a dcid that does not exist.
res_json = json.dumps([
res_json = json.dumps({'dc/p/x6t44d8jd95rd' : '18704962.000000'}) if kwargs['new_mixer_api'] else json.dumps([
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@mvashishtha mvashishtha marked this pull request as draft January 12, 2022 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants