Skip to main content

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


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.4.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

arcane_bing-0.4.4-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file arcane_bing-0.4.4.tar.gz.

File metadata

  • Download URL: arcane_bing-0.4.4.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.0 Linux/6.2.0-1016-azure

File hashes

Hashes for arcane_bing-0.4.4.tar.gz
Algorithm Hash digest
SHA256 aa120c3564e261b0c01c9585c3dc70f1d5c05ff9e267484656171fc9cbfef3d4
MD5 ff163d452e9f7881e6cd88f01fbac63f
BLAKE2b-256 799f441b44603e7238df992318a779fc05a2e385a48f48b325ff7800e5a715e4

See more details on using hashes here.

File details

Details for the file arcane_bing-0.4.4-py3-none-any.whl.

File metadata

  • Download URL: arcane_bing-0.4.4-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.0 Linux/6.2.0-1016-azure

File hashes

Hashes for arcane_bing-0.4.4-py3-none-any.whl
Algorithm Hash digest
SHA256 502913e8e675107809a0e7f3c67c263d1a720790cbeb6869981070cde1c7fb39
MD5 338b93e6920a6585bace6672b5d21734
BLAKE2b-256 e3380081a6b13fdac8a99d639f73b748adf2573c554a185370c314e54d20e6f7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page