Skip to content

Commit e6a2b1b

Browse files
committed
Update READMEs and add .gitignore
1 parent 7f40dba commit e6a2b1b

File tree

4 files changed

+114
-3
lines changed

4 files changed

+114
-3
lines changed

.gitignore

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
*.py[cod]
2+
*.sw[op]
3+
4+
# C extensions
5+
*.so
6+
7+
# Packages
8+
*.egg
9+
*.egg-info
10+
dist
11+
build
12+
eggs
13+
.eggs
14+
parts
15+
bin
16+
var
17+
sdist
18+
develop-eggs
19+
.installed.cfg
20+
lib
21+
lib64
22+
__pycache__
23+
24+
# Installer logs
25+
pip-log.txt
26+
27+
# Unit test / coverage reports
28+
.coverage
29+
.nox
30+
.cache
31+
.pytest_cache
32+
33+
34+
# Mac
35+
.DS_Store
36+
37+
# JetBrains
38+
.idea
39+
40+
# VS Code
41+
.vscode
42+
43+
# emacs
44+
*~
45+
46+
# Built documentation
47+
docs/_build
48+
docs.metadata
49+
50+
# Virtual environment
51+
env/
52+
venv/
53+
54+
# Test logs
55+
coverage.xml
56+
*sponge_log.xml
57+
58+
# System test environment variables.
59+
system_tests/local_test_setup
60+
61+
# Make sure a generated file isn't accidentally committed.
62+
pylintrc
63+
pylintrc.test
64+

README.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,15 @@
1-
# python-docs-samples
1+
# Google Analytics Python Samples
2+
3+
Python samples for [Google Analytics APIs][ga].
4+
5+
Check out the `README.md` in one of the following directories to get started:
6+
7+
- Admin API: [README.md](google-analytics-admin/README.md)
8+
- Data API: [README.md](google-analytics-data/README.md)
9+
10+
## Contributing
11+
12+
Contributions welcome! See the [Contributing Guide](CONTRIBUTING.md).
13+
14+
[ga]: https://developers.google.com/analytics
15+

google-analytics-admin/README.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Google Analytics Admin API examples
2+
3+
[![Open in Cloud Shell][shell_img]][shell_link]
4+
5+
[shell_img]: http://gstatic.com/cloudssh/images/open-btn.png
6+
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleanalytics/python-docs-samples&page=editor&open_in_editor=/google-analytics-admin/README.md
7+
8+
These samples show how to use the
9+
[Google Analytics Data API](https://developers.google.com/analytics/devguides/reporting/data/v1) from Python.
10+
11+
## Build and Run
12+
1. **Enable APIs** - [Enable the Analytics Data API](https://console.cloud.google.com/flows/enableapi?apiid=analyticsdata.googleapis.com)
13+
and create a new project or select an existing project.
14+
2. **Download The Credentials** - Configure your project using [Application Default Credentials][adc].
15+
Click "Go to credentials" after enabling the APIs. Click "Create Credentials"
16+
and select "Service Account Credentials" and download the credentials file. Then set the path to
17+
this file to the environment variable `GOOGLE_APPLICATION_CREDENTIALS`:
18+
```sh
19+
$ export GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json
20+
```
21+
3. **Clone the repo** and cd into this directory
22+
```sh
23+
$ git clone https://github.com/googleanalytics/python-docs-samples
24+
$ cd google-analytics-admin
25+
```
26+
4. **Install dependencies** via [pip3](https://pip.pypa.io/en/stable).
27+
Run `pip3 install --upgrade google-analytics-data`.
28+
5. **Review the comments starting with `TODO(developer)` and update the code
29+
to use correct values.**
30+
6. **Run** with the command `python3 SNIPPET_NAME.py`. For example:
31+
```sh
32+
$ python3 quickstart.py
33+
```

google-analytics-data/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Open in Cloud Shell][shell_img]][shell_link]
44

55
[shell_img]: http://gstatic.com/cloudssh/images/open-btn.png
6-
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleanalytics/python-docs-samples&page=editor&open_in_editor=/README.md
6+
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleanalytics/python-docs-samples&page=editor&open_in_editor=/google-analytics-data/README.md
77

88
These samples show how to use the
99
[Google Analytics Data API](https://developers.google.com/analytics/devguides/reporting/data/v1) from Python.
@@ -26,7 +26,7 @@ These samples show how to use the
2626
4. **Install dependencies** via [pip3](https://pip.pypa.io/en/stable).
2727
Run `pip3 install --upgrade google-analytics-data`.
2828
5. **Review the comments starting with `TODO(developer)` and update the code
29-
to use correct values.
29+
to use correct values.**
3030
6. **Run** with the command `python3 SNIPPET_NAME.py`. For example:
3131
```sh
3232
$ python3 quickstart.py

0 commit comments

Comments
 (0)