Skip to content

TDL-14567: Check linkedin ads accounts in discover mode #35

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

Merged

Conversation

savan-chovatiya
Copy link
Contributor

@savan-chovatiya savan-chovatiya commented Jul 30, 2021

Description of change

TDL-14567:The account_number should be validated in the discovery mode

  • Added Account users API call for every account provided in the config for discover mode and raised an error if accounts are an invalid number or invalid for LinkedIn.

Manual QA steps

  • Verified that exception is raised with list of invalid accounts in discover mode if any accounts are invalid number or invalid for LinkedIn.

Risks

Rollback steps

  • revert this branch

@savan-chovatiya savan-chovatiya marked this pull request as draft July 30, 2021 12:48
@savan-chovatiya savan-chovatiya marked this pull request as ready for review August 3, 2021 07:31

LOGGER.info('Starting discover')
check_accounts_list(config)
check_accounts_list(config) # Check that accounts are valid numbers.
client.check_accounts(config) # Check that accounts are valid LinkedIn Ads account.

Choose a reason for hiding this comment

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

@savan-chovatiya There should be a single function for checking the accounts list. Can you make changes to the check_accounts_list() function to also check if the account is valid or not?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@karanpanchal-crest I have removed check_accounts_list() function and handled that scenario in check_accounts() function itself.

elif response.status_code != 200:
raise_for_error(response)
if invalid_account:
error_message = 'These accounts are invalid LinkedIn Ads accounts from provided accounts:{}'.format(invalid_account)

Choose a reason for hiding this comment

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

@savan-chovatiya The error message should be: "Invalid Linked Ads accounts provided during the configuration: [a1, a2. a3]"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@karanpanchal-crest Updated error message as per suggestion.

int(account)
except ValueError as e:
message = "The account '{}' provided in the configuration is having non-numeric value.".format(account)
raise ValueError(message) from None
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed this function as we have added API calls for validating accounts. Those calls will return 400 code for accounts with an invalid number format.

Copy link
Contributor

@KAllan357 KAllan357 left a comment

Choose a reason for hiding this comment

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

Please fix conflicts

@KAllan357 KAllan357 merged commit 896b5f0 into master Aug 12, 2021
@KAllan357 KAllan357 deleted the TDL-14567-valid-linkedin-ads-accounts-in-discover-mode branch August 12, 2021 18:31
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.

5 participants