Helpers to request bing API
Project description
Arcane bing
This package is based on bingads.
Get Started
pip install arcane-bing
Example Usage
Reporting
bing_client = Client(
credentials=Config.BING_ADS_CREDENTIALS,
secrets_bucket=Config.SECRETS_BUCKET,
refresh_token_location=Config.BING_ADS_REFRESH_TOKEN,
storage_client=storage_client
)
reporting_service_manager, reporting_service = bing_client.get_bing_ads_api_client()
report_request = build_campaigns_report(reporting_service, bing_account_id)
result_file_path = bing_client.submit_and_download(report_request, reporting_service_manager)
Campaign Service
:warning: For some API methods, you must provide the client's account id and the manager's customer id
from arcane.bing import Client
from arcane.bing.helpers import parse_webfault_errors, parse_bing_response
bing_client = Client(
credentials=Config.BING_ADS_CREDENTIALS,
secrets_bucket=Config.SECRETS_BUCKET,
refresh_token_location=Config.BING_ADS_REFRESH_TOKEN,
storage_client=storage_client,
customer_id=CUSTOMER_ID,
account_id=ACCOUNT_ID
)
campaign_service = bing_client.get_service_client(service_name='CampaignManagement')
try:
response = campaign_service.GetCampaignsByAccountId(AccountId=ACCOUNT_ID)
all_campaigns = parse_bing_response(response)['Campaign']
# do stuff with all_campaigns
except WebFault as e:
bing_error = parse_webfault_errors(e)
# do stuff with bing_error
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
arcane-bing-0.4.1.tar.gz
(5.9 kB
view hashes)
Built Distribution
Close
Hashes for arcane_bing-0.4.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 952f2f2923b1905304bccb46ca230fe4808b2e9d2532fd7e31b7dd2699a1da43 |
|
MD5 | 158701006675c858c1eb1c8879bcbc00 |
|
BLAKE2b-256 | 2634855dc0d250f8f1286c0a47e86d7a412be3a55f02d5d8194fad2c21ec8bf7 |