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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: arcane_bing-0.5.7.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.12.12 Linux/6.11.0-1018-azure

File hashes

Hashes for arcane_bing-0.5.7.tar.gz
Algorithm Hash digest
SHA256 559686d1e7e64c470779cd129e3c3f4a086aff9952668140145123a9ed03dbaa
MD5 9a3cd49fc03ed5b311b9826a7054cee0
BLAKE2b-256 b0d0a48470cd4c5e67589d7cef800f2d064e931f1a9b23782b6e06d0e052ab76

See more details on using hashes here.

File details

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

File metadata

  • Download URL: arcane_bing-0.5.7-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.12.12 Linux/6.11.0-1018-azure

File hashes

Hashes for arcane_bing-0.5.7-py3-none-any.whl
Algorithm Hash digest
SHA256 1177d5c427498b141f6844513bfa023452a3b7847e412d35a93066c85ea38534
MD5 804d6bd21d3b4dc3594edd445f78da14
BLAKE2b-256 e67382519b4d2f76a048b625213848eb43f3ffda9ef60c724e4a194f3aa6b72b

See more details on using hashes here.

Supported by

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