<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 1. Install Dependencies
First install the libraries needed to execute recipes, this only needs to be done once, then click play.
Step1:  2. Get Cloud Project ID
To run this recipe requires a Google Cloud Project, this only needs to be done once, then click play.
Step2:  3. Get Client Credentials
To read and write to various endpoints requires downloading client credentials, this only needs to be done once, then click play.
Step3:  4. Enter CM360 Conversion Upload From Sheets Parameters
Move form Sheets to CM.
 1. Specify a CM Account ID, Floodligh Activity ID and Conversion Type.
 1. Include Sheets url, tab, and range, omit headers in range.
 1. Columns
Step4:  5. Execute CM360 Conversion Upload From Sheets
This does NOT need to be modified unless you are changing the recipe, click play.
<ASSISTANT_TASK:>
Python Code:
!pip install git+https://github.com/google/starthinker
Explanation: 1. Install Dependencies
First install the libraries needed to execute recipes, this only needs to be done once, then click play.
End of explanation
CLOUD_PROJECT = 'PASTE PROJECT ID HERE'
print("Cloud Project Set To: %s" % CLOUD_PROJECT)
Explanation: 2. Get Cloud Project ID
To run this recipe requires a Google Cloud Project, this only needs to be done once, then click play.
End of explanation
CLIENT_CREDENTIALS = 'PASTE CREDENTIALS HERE'
print("Client Credentials Set To: %s" % CLIENT_CREDENTIALS)
Explanation: 3. Get Client Credentials
To read and write to various endpoints requires downloading client credentials, this only needs to be done once, then click play.
End of explanation
FIELDS = {
  'dcm_account': '',
  'auth_read': 'user',  # Credentials used for reading data.
  'floodlight_activity_id': '',
  'floodlight_conversion_type': 'encryptedUserId',
  'encryption_entity_id': '',
  'encryption_entity_type': 'DCM_ACCOUNT',
  'encryption_entity_source': 'DATA_TRANSFER',
  'sheet_url': '',
  'sheet_tab': '',
  'sheet_range': '',
}
print("Parameters Set To: %s" % FIELDS)
Explanation: 4. Enter CM360 Conversion Upload From Sheets Parameters
Move form Sheets to CM.
 1. Specify a CM Account ID, Floodligh Activity ID and Conversion Type.
 1. Include Sheets url, tab, and range, omit headers in range.
 1. Columns: Ordinal, timestampMicros, encryptedUserId | encryptedUserIdCandidates | gclid | mobileDeviceId
 1. Include encryption information if using encryptedUserId or encryptedUserIdCandidates.
Modify the values below for your use case, can be done multiple times, then click play.
End of explanation
from starthinker.util.project import project
from starthinker.script.parse import json_set_fields
USER_CREDENTIALS = '/content/user.json'
TASKS = [
  {
    'conversion_upload': {
      'auth': 'user',
      'account_id': {'field': {'name': 'dcm_account','kind': 'string','order': 0,'default': ''}},
      'activity_id': {'field': {'name': 'floodlight_activity_id','kind': 'integer','order': 1,'default': ''}},
      'conversion_type': {'field': {'name': 'floodlight_conversion_type','kind': 'choice','order': 2,'choices': ['encryptedUserId','encryptedUserIdCandidates','gclid','mobileDeviceId'],'default': 'encryptedUserId'}},
      'encryptionInfo': {
        'encryptionEntityId': {'field': {'name': 'encryption_entity_id','kind': 'integer','order': 3,'default': ''}},
        'encryptionEntityType': {'field': {'name': 'encryption_entity_type','kind': 'choice','order': 4,'choices': ['ADWORDS_CUSTOMER','DBM_ADVERTISER','DBM_PARTNER','DCM_ACCOUNT','DCM_ADVERTISER','ENCRYPTION_ENTITY_TYPE_UNKNOWN'],'default': 'DCM_ACCOUNT'}},
        'encryptionSource': {'field': {'name': 'encryption_entity_source','kind': 'choice','order': 5,'choices': ['AD_SERVING','DATA_TRANSFER','ENCRYPTION_SCOPE_UNKNOWN'],'default': 'DATA_TRANSFER'}}
      },
      'sheets': {
        'url': {'field': {'name': 'sheet_url','kind': 'string','order': 9,'default': ''}},
        'tab': {'field': {'name': 'sheet_tab','kind': 'string','order': 10,'default': ''}},
        'range': {'field': {'name': 'sheet_range','kind': 'string','order': 11,'default': ''}}
      }
    }
  }
]
json_set_fields(TASKS, FIELDS)
project.initialize(_recipe={ 'tasks':TASKS }, _project=CLOUD_PROJECT, _user=USER_CREDENTIALS, _client=CLIENT_CREDENTIALS, _verbose=True, _force=True)
project.execute(_force=True)
Explanation: 5. Execute CM360 Conversion Upload From Sheets
This does NOT need to be modified unless you are changing the recipe, click play.
End of explanation
<END_TASK>