X Tutup
The Wayback Machine - https://web.archive.org/web/20210131050257/https://github.com/datacommonsorg/api-python/pull/116
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

Open
wants to merge 1 commit into
base: master
from

Conversation

@mvashishtha
Copy link

@mvashishtha mvashishtha commented Feb 5, 2020

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.
@mvashishtha mvashishtha requested a review from shifucun Feb 5, 2020
Copy link
Collaborator

@shifucun shifucun left a comment

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([

This comment has been minimized.

@shifucun

shifucun Feb 5, 2020
Collaborator

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([

This comment has been minimized.

@shifucun

shifucun Feb 5, 2020
Collaborator

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([

This comment has been minimized.

@shifucun

shifucun Feb 5, 2020
Collaborator

same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
X Tutup