تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
تتم استضافة مكتبة برامج Python على GitHub،
وتتوفّر الحزمة على PyPI.
المتطلبات
تتطلّب المكتبة الإصدار 3.8 من Python أو إصدارًا أحدث.
المتطلبات الأساسية
قبل تثبيت المكتبة، ستحتاج إلى رمز مطوّر ورقم تعريف العميل. يمكنك الاطّلاع على تعليمات حول كيفية الحصول عليها في قسم
المتطلبات الأساسية.
يُرجى العِلم أنّك ستنشئ رموز OAuth2 المميزة الأخرى المطلوبة في خطوات لاحقة.
عند اعتماد إصدارات جديدة من وقت تشغيل Python، نسعى إلى طرح إصدار جديد من مكتبة برامج Python المتوافق مع أحدث وقت تشغيل بحلول نهاية الربع التالي من تاريخ طرحه. على سبيل المثال، إذا تم إصدار وقت تشغيل جديد في أكتوبر، سيتوفّر إصدار متوافق من مكتبة برامج Python بحلول نهاية مارس من العام التالي.
لا تتوافق أوقات تشغيل Python التي انتهت دورة حياتها مع الإصدارات التي تلي تاريخ انتهاء دورة الحياة المذكور في قسم الإصدارات غير المتوافقة على موقع python.org.
قد نُصدر إصدارًا من مكتبة برامج Python غير متوافق مع أوقات تشغيل Python غير المتوافقة في أي وقت بعد بلوغها تاريخ انتهاء الدعم.
للحصول على قائمة كاملة بأوقات تشغيل Python والتبعيات المتوافقة، راجِع صفحة التبعيات.
تثبيت
اتّبِع التعليمات الواردة في مستندات التثبيت لتثبيت المكتبة من PyPi والعودة إلى هذه الصفحة.
الإعداد
بعد تثبيت المكتبة، عليك إعداد ضبط لها. تتوفّر عدة طرق لإعداد المكتبة، وهي موضّحة في مستندات الإعداد.
المصادقة
بعد اختيار نوع الإعداد، يمكنك المتابعة لإنشاء الرموز المميزة المتبقية الخاصة ببروتوكول OAuth2 اللازمة لإرسال الطلبات إلى واجهة برمجة التطبيقات. تتوفّر عدة عمليات OAuth2 متوافقة، وهي موضّحة في القائمة أدناه. للحصول على تفاصيل حول الاختلافات بين عمليات التدفق والمساعدة في تحديد العملية الأنسب لتطبيقك، راجِع مستندات OAuth.
بعد دمج رموز OAuth2 المميزة في عملية الإعداد، يمكنك تقديم طلب إلى واجهة برمجة التطبيقات. راجِع مثال
الحصول على الحملات للتعرّف على
طريقة بسيطة لاختبار ما إذا كانت المكتبة معدّة بشكل صحيح لإجراء طلبات
من واجهة برمجة التطبيقات.
لتشغيل نموذج get_campaigns.py، نفِّذ الأمر التالي في الدليل الجذر لمكتبة عميل googleads-python المثبَّتة محليًا:
تاريخ التعديل الأخير: 2025-09-05 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","easyToUnderstand","thumb-up"],["ساعَدني المحتوى في حلّ مشكلتي.","solvedMyProblem","thumb-up"],["غير ذلك","otherUp","thumb-up"]],[["لا يحتوي على المعلومات التي أحتاج إليها.","missingTheInformationINeed","thumb-down"],["الخطوات معقدة للغاية / كثيرة جدًا.","tooComplicatedTooManySteps","thumb-down"],["المحتوى قديم.","outOfDate","thumb-down"],["ثمة مشكلة في الترجمة.","translationIssue","thumb-down"],["مشكلة في العيّنات / التعليمات البرمجية","samplesCodeIssue","thumb-down"],["غير ذلك","otherDown","thumb-down"]],["تاريخ التعديل الأخير: 2025-09-05 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eThe Google Ads Python client library requires Python 3.8 or later and is compatible with supported Python runtimes, with new runtime support added by the end of the quarter following a new runtime's release.\u003c/p\u003e\n"],["\u003cp\u003eYou need a developer token and client customer ID before installation, and OAuth2 tokens are generated during the authentication process.\u003c/p\u003e\n"],["\u003cp\u003eConfiguration options are provided, along with guidance on OAuth flows for desktop/web and service accounts to authenticate API requests.\u003c/p\u003e\n"],["\u003cp\u003eA sample \u003ccode\u003eget_campaigns.py\u003c/code\u003e script helps test API request functionality, and resources on logging, field masks, and other library features are available.\u003c/p\u003e\n"],["\u003cp\u003eThe library is hosted on GitHub and available on PyPI for installation.\u003c/p\u003e\n"]]],[],null,["# Overview\n\nThe Python client library is hosted [on GitHub](https://github.com/googleads/google-ads-python),\nand the package is available on [PyPI](//pypi.org/project/google-ads/).\n\n### Requirements\n\nThe library requires Python 3.8 or later.\n\n### Prerequisites\n\nBefore installing the library, you will need a developer token and\nclient customer ID. Instructions on how to obtain them are outlined in the\n[prerequisites](/google-ads/api/docs/get-started/introduction) section.\nNote that you will generate the other required OAuth2 tokens in later steps.\n\n### Runtime and dependency compatibility\n\nThe Python client library maintains compatibility with the Python runtimes in\nthe\n[Supported Versions](https://devguide.python.org/versions/#supported-versions)\nsection published by the\n[Python Software Foundation](https://www.python.org/psf-landing/), except for\nversions with a status of \"feature\" or \"prerelease\".\n\nWhen adopting new versions of the Python runtime, we aim to release a new\nversion of the Python client library that is compatible with the latest runtime\nby the end of the quarter following its release. For example, if a new runtime\nis released in October, a compatible version of the Python client library will\nbe available by the end of March in the following year.\n\nPython runtimes that have reached End of Life (EOL) are not supported past the\nEnd of Life date in the\n[Unsupported Versions](https://www.python.org/psf-landing/) section of\n[python.org](https://www.python.org/).\n\nWe may release a version of the Python client library that is incompatible with\nunsupported Python runtimes at any point after they reach EOL.\n\nFor dependencies, (specifically, any Google-maintained packages that are\n[listed as required](//github.com/googleads/google-ads-python/blob/ef62b42152781ee6dc9081222dca49a758760544/setup.py#L18)\nby the Python client library), we will maintain compatibility with packages that\nare Google-maintained, and considered \"supported\" according to Google's\n[OSS Breaking Change Policy](https://opensource.google/documentation/policies/library-breaking-change).\n\nFor a complete list of supported Python runtimes and dependencies, see the\n[Dependencies](/google-ads/api/docs/client-libs/python/dependencies) page.\n\n### Installation\n\nFollow the instructions in our [installation](/google-ads/api/docs/client-libs/python/installation#install_the_module_from_pypi)\ndocumentation to install the library from PyPi and return to this page.\n\n### Configuration\n\nOnce you have installed the library you will need to set up a configuration for\nit. There are multiple ways to configure the library, which are described in our\n[configuration](/google-ads/api/docs/client-libs/python/configuration) documentation.\n\n### Authentication\n\nOnce you've chosen a configuration type you can proceed with generating the\nremaining OAuth2 tokens needed to make requests to the API. There are multiple\nsupported OAuth2 flows, which are documented in the list below. For details on\nthe differences between the flows and help deciding which is best for your\napplication, see our [OAuth](/google-ads/api/docs/oauth/overview) documentation.\n\n- [OAuth desktop and web application flows](/google-ads/api/docs/client-libs/python/oauth-web)\n- [OAuth service account flow](/google-ads/api/docs/client-libs/python/oauth-service)\n\n### Making an API request\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nOnce you've incorporated your OAuth2 tokens into your configuration, you're\nready to make an API request. Refer to the\n[get campaigns](/google-ads/api/samples/get-campaigns#python) example for\na simple way to test that the library is properly configured to make API\nrequests.\n\nTo run the `get_campaigns.py` sample, in the root directory of your locally\ninstalled `googleads-python` client library, run the following command: \n\n $ python examples/basic_operations/get_campaigns.py -c \\\n INSERT_YOUR_CUSTOMER_ID_HERE\n\n### Additional resources\n\nAfter you're able to make an API request, proceed to these uses of the client\nlibrary:\n\n- [Logging](/google-ads/api/docs/client-libs/python/logging)\n- [Field Masks](/google-ads/api/docs/client-libs/python/field-masks)\n- [Resource Names](/google-ads/api/docs/client-libs/python/resource-names)\n- [Proto Getters](/google-ads/api/docs/client-libs/python/proto-getters)\n- [Setting Empty Message Fields](/google-ads/api/docs/client-libs/python/empty-message-fields)"]]