I have an android application and user data is stored on the firestore. I want to fetch that data and manipulate the results on Google Cloud Functions (for ranking system) with python and directly send those results to Firebase Remote Config, so that user can fetch the data from there.
In official document they have showed the same thing in picture.
But the description is totally different.Documentation.
So my question is: Can I send the Results which are calculated on the google cloud function directly to the firebase remote config?
Also we have a REST API to get and change Firebase Remote Config values. Is that possible that we can call this api at our Google Cloude Function?
. I am using this code which requires a token,however I am using this cloud function on the based on same account as Remore config
def _get():
Retrieve the current Firebase Remote Config template from server and store it locally.
headers = {
'Authorization': 'Bearer ' + _get_access_token()
}
resp = requests.get(REMOTE_CONFIG_URL, headers=headers)
if resp.status_code == 200:
with io.open('config.json', 'wb') as f:
f.write(resp.text.encode('utf-8'))
print('Retrieved template has been written to config.json')
print('ETag from server: {}'.format(resp.headers['ETag']))
else:
print('Unable to get template')
print(resp.text)
Here is the code for Publish the data
`def _publish(etag):
"""Publish local template to Firebase server.
Args:
etag: ETag for safe (avoid race conditions)
"""
with open('**config.json**', 'r', encoding='utf-8') as f:
content = f.read()
headers = {
'Authorization': 'Bearer ' + _get_access_token(),
'Content-Type': 'application/json; UTF-8',
'If-Match': etag
}
resp = requests.
put(REMOTE_CONFIG_URL,
data=content.encode('utf-8'),headers=headers)
if resp.status_code == 200:
print('Template has been published.')
print('ETag from server: {}'.format(resp.headers['ETag']))
else:
print('Unable to publish template.')
print(resp.text)`
Just like I can access the firestore database without authentication in my cloud function why can't I update the Remote config without config.json? Function only have 2 files main.py and Requirements
If Authentication is necessary for google cloud function to update the Remote Config where can I store the config.json file?