{ "info": { "author": "Ad Engineering FANDOM", "author_email": "murbanek@fandom.com", "bugtrack_url": null, "classifiers": [ "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# sroka package\n\nPackage providing simple Python access to data in:\n* Google Analytics\n* Google AdManager (GAM earlier DoubleClick for Publishers, DFP)\n* MOAT\n* Qubole\n* Rubicon\n* Athena\n* Google sheets\n* s3\n\n## Developers\n\nInstall requirements and enable custom githooks:\n```\npip install -r requirements.txt\ngit config --local core.hooksPath .githooks/\n``` \nCheck style with flake8:\n```\nflake8 .\n```\n\n\n## Installation\n\n```pip install git+ssh://git@github.com/Wikia/sroka```\n\n\n## Configuration\n\nin home folder create `~/.sroka_config` (hidden folder) file where you will store:\n* ```config.ini``` file based on ```config.sample.ini``` with information to access Qubole, MOAT, Athena, S3 and Rubicon\n* ```client_secrets.json``` for GA access\n* ```ad_manager.json``` for GAM access\n\nAlternatively, you may set localization of your files during analysis:\n\n```python\nfrom sroka.config.config import setup_env_variables\nfrom sroka.config.config import setup_client_secret\nfrom sroka.config.config import setup_admanager_config\nsetup_env_variables('/file_path/config.ini')\nsetup_client_secret('/file_path/client_secrets.json')\nsetup_admanager_config('/file_path/ad_manager.json')\n```\n\n## Getting GA, GAM ang Google docs jsons with secrets\n\n### Google Analytics\n\n1.\tUse\u00a0[this wizard](https://console.developers.google.com/flows/enableapi?apiid=analytics.googleapis.com)\u00a0\nto create or select a project in the Google Developers Console and automatically turn on the API. Click\u00a0Continue, then\u00a0Go to credentials.\n2.\tOn the\u00a0Add credentials to your project\u00a0page, click the\u00a0Cancel\u00a0button.\n3.\tAt the top of the page, select the\u00a0OAuth consent screen\u00a0tab. Select an\u00a0Email address, enter a\u00a0Product name\u00a0if not already set, and click the\u00a0Save\u00a0button.\n4.\tSelect the\u00a0Credentials\u00a0tab, click the\u00a0Create credentials\u00a0button and select\u00a0OAuth client ID.\n5.\tSelect the application type\u00a0Other, enter the chosen name, and click the\u00a0Create\u00a0button.\n6.\tClick\u00a0OK\u00a0to dismiss the resulting dialog.\n7.\tClick the\u00a0file_download\u00a0(Download JSON) button to the right of the client ID.\n\n\n### GAM\n\n1. Follow [these instructions](https://developers.google.com/ad-manager/api/authentication#service) \n - while adding a service account note that the role needs to have necessary viewing and reporting permissions.\n\nYou should end up with .json (!) file with credentials\n\n2. Make sure the *Name* in \"OAuth 2.0 client IDs\" matches the *service account* in \"Service account keys\": [here](https://console.developers.google.com/apis/credentials)\n4. Create GAM account as service account not a new user: https://support.google.com/admanager/answer/6078734?hl=en\n3. Once you have a service account, it can be used to access data in different networks. Simply add it as a new service account through GAM UI of the second network.\n4. Additional information can be specified in ```config.ini``` file:\n* network code - a default value that can be overwritten in a function call\n* application name - custom name of your network, if not specified, a generic value will be passed.\n\n\n### Google drive sheets credentials\n\nGo to [link](https://developers.google.com/sheets/api/quickstart/python) and click blue button\n`ENABLE THE GOOGLE SHEETS API` to create a project with access to google sheets. You should\nend up with `credentials.json` file that should be downloaded to `~/.sroka_config` folder.\n\n\n\n## Getting access tokens to Qubole and Athena\n\n### Qubole\n\n1. Find your Qubole API Token (go to user -> My Profile -> my_account -> API Token -> show)\n2. Copy your Qubole API Token to ```config.ini``` file\n\n\n### Athena and s3 credentials\n\n1. You should have your aws_access_key_id and aws_secret_access_key from registration process in AWS console.\n2. s3bucket_name can be found in AWS console in Athena view when you click `Settings`, there you have `Query result location`.\nThe name of location without `s3://` and `/` is what you need.\n3. For Athena usage you need to set also region (AWS regional endpoint), e.g. `'us-east-1'`\n\n\n### Rubicon credentials\n1. You should have your id, username and password from Rubicon\n2. Copy values to ```config.ini``` file in relevant fields\n\n## Common issues\n\n### macOS\n\nIf you see an error like `ValueError: unknown locale: UTF-8`\n\nPlease add to `~/.bash_profile` lines like this:\n\n```\nexport LC_ALL=en_US.UTF-8\nexport LANG=en_US.UTF-8\n```\n### installing sroka\n\n1. If `PyYAML` package is not building correctly, it may be caused by the fact that newer versions of pip won\u2019t uninstall the package because it\u2019s handled by disutils. Please install `PyYAML` package first with `--ignore-installed` flag. \n\n2. If numpy gets messed up during sroka installation it is probably caused by multiple versions installed. Please uninstall all using pip uninstall and then reinstall latest one.\n\n## Credits\n\nAll people that contributed to sroka development, also before going opensource (including CR and QA):\n* [martynaut](https://github.com/martynaut)\n* [dorotamierzwa](https://github.com/dorotamierzwa)\n* [fraszczakszymon](https://github.com/fraszczakszymon)\n* [bckatarzyna](https://github.com/bckatarzyna)\n* [jacekbj](https://github.com/jacekbj)\n* [nandy-andy](https://github.com/nandy-andy)\n* [dmnsobczak](https://github.com/dmnsobczak)\n* [szczeles](https://github.com/szczeles)\n* [kvas-damian](https://github.com/kvas-damian)\n* [pnather](https://github.com/pnather)\n* [philthyharry](https://github.com/philthyharry)\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Wikia/sroka", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "sroka", "package_url": "https://pypi.org/project/sroka/", "platform": "", "project_url": "https://pypi.org/project/sroka/", "project_urls": { "Homepage": "https://github.com/Wikia/sroka" }, "release_url": "https://pypi.org/project/sroka/0.0.1/", "requires_dist": [ "google-auth-oauthlib (>=0.2.0)", "googleads (>=14.1.0)", "google-api-python-client (>=1.6.7)", "google-auth-httplib2 (>=0.0.3)", "pandas (>=0.23.4)", "qds-sdk (>=1.10.1)", "boto3 (>=1.9.19)", "retrying (>=1.3.3)", "pyarrow (>=0.11.1)", "botocore (>=1.12.19)", "numpy (>=1.16.2)", "urllib3 (>=1.23)" ], "requires_python": "", "summary": "Package for access GA, GAM, MOAT, Qubole, Athena, S3, Rubicon APIs", "version": "0.0.1" }, "last_serial": 5181968, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "c40f210d64f3338e56bc47f5c4e31b1b", "sha256": "217b254d1de4952ddf2c595affda61cd1cdde8d10d4fe99088994bbedf84ea2f" }, "downloads": -1, "filename": "sroka-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "c40f210d64f3338e56bc47f5c4e31b1b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 19228, "upload_time": "2019-04-24T12:06:13", "url": "https://files.pythonhosted.org/packages/c0/e6/b67178fa86e78c0a080bacb924058a962e1b80b0ff88451b891627264792/sroka-0.0.1-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c40f210d64f3338e56bc47f5c4e31b1b", "sha256": "217b254d1de4952ddf2c595affda61cd1cdde8d10d4fe99088994bbedf84ea2f" }, "downloads": -1, "filename": "sroka-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "c40f210d64f3338e56bc47f5c4e31b1b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 19228, "upload_time": "2019-04-24T12:06:13", "url": "https://files.pythonhosted.org/packages/c0/e6/b67178fa86e78c0a080bacb924058a962e1b80b0ff88451b891627264792/sroka-0.0.1-py3-none-any.whl" } ] }