Python samples for Google Cloud Platform products.
Check out some of the samples found on this repository on the Google Cloud Samples page.
-
Install
pipandvirtualenvif you do not already have them. -
Clone this repository:
git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git -
Obtain authentication credentials.
Create local credentials by running the following command and following the oauth2 flow (read more about the command here):
gcloud auth application-default loginRead more about Google Cloud Platform Authentication.
-
Change directory to one of the sample folders, e.g.
logging/cloud-client:cd logging/cloud-client/ -
Create a virtualenv. Samples are compatible with Python 3.6+.
python3 -m venv env source env/bin/activate -
Install the dependencies needed to run the samples.
pip install -r requirements.txt -
Run the sample:
python snippets.py
Contributions welcome! See the Contributing Guide.
<title>Delete, allow, and manage cookies in Chrome</title> <style> * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; background-color: #fff; color: #1f1f1f; line-height: 1.6; padding: 24px 16px; } .container { max-width: 800px; margin: 0 auto; } h1 { font-size: 2rem; font-weight: 500; letter-spacing: -0.02em; margin-bottom: 0.25rem; } .subhead { font-size: 1rem; color: #3c4043; margin-bottom: 1.5rem; } hr { border: none; border-top: 1px solid #dadce0; margin: 1.5rem 0; } h2 { font-size: 1.5rem; font-weight: 500; margin: 1.5rem 0 0.5rem; } h3 { font-size: 1.2rem; font-weight: 500; margin: 1.25rem 0 0.25rem; } p, li { color: #202124; margin-bottom: 0.75rem; } ul, ol { padding-left: 1.5rem; margin-bottom: 1rem; } li { margin-bottom: 0.3rem; } .note, .tip { background-color: #f8f9fa; border-left: 4px solid #1a73e8; padding: 0.75rem 1rem; margin: 1rem 0; border-radius: 0 4px 4px 0; } .tip { border-left-color: #34a853; } .code-block { background: #f1f3f4; padding: 0.75rem 1rem; border-radius: 6px; font-family: 'Roboto Mono', 'Courier New', monospace; font-size: 0.9rem; overflow-x: auto; margin: 0.75rem 0; white-space: pre-wrap; word-break: break-word; } .badge { display: inline-block; background: #e8eaed; padding: 0.1rem 0.6rem; border-radius: 12px; font-size: 0.75rem; font-weight: 500; color: #3c4043; margin-right: 0.3rem; } .device-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0 0.5rem; } .device-tab { background: #e8eaed; padding: 0.3rem 1rem; border-radius: 20px; font-size: 0.85rem; font-weight: 500; color: #3c4043; } .device-tab.active { background: #1a73e8; color: white; } .step-list { list-style-type: decimal; padding-left: 1.5rem; } .step-list li { margin-bottom: 0.3rem; } .button-ghost { display: inline-block; background: #f1f3f4; padding: 0.1rem 0.6rem; border-radius: 4px; font-family: inherit; font-size: 0.9rem; } .toggle-row { display: flex; align-items: center; gap: 0.5rem; margin: 0.5rem 0; flex-wrap: wrap; } .toggle-label { font-weight: 500; min-width: 140px; } .toggle-value { background: #e8eaed; padding: 0.1rem 0.8rem; border-radius: 12px; font-size: 0.8rem; } .footer-links { margin-top: 2.5rem; border-top: 1px solid #dadce0; padding-top: 1.5rem; display: flex; flex-wrap: wrap; gap: 1rem 2rem; } .footer-links a, .related a { color: #1a73e8; text-decoration: none; } .footer-links a:hover, .related a:hover { text-decoration: underline; } .related { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid #dadce0; } .related h3 { margin-top: 0; } .feedback { background: #f8f9fa; padding: 1rem; border-radius: 8px; margin: 2rem 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem; } .feedback span { font-weight: 500; } .feedback .btn-group { display: flex; gap: 0.75rem; } .feedback .btn-group button { background: none; border: 1px solid #dadce0; padding: 0.2rem 1.2rem; border-radius: 20px; font-size: 0.9rem; cursor: default; color: #3c4043; } .help-community { background: #f8f9fa; padding: 1rem; border-radius: 8px; margin: 1rem 0; } .help-community p { margin-bottom: 0.25rem; } .help-community a { color: #1a73e8; text-decoration: none; } .help-community a:hover { text-decoration: underline; } @media (max-width: 480px) { h1 { font-size: 1.6rem; } .device-tabs { gap: 0.3rem; } .device-tab { font-size: 0.75rem; padding: 0.2rem 0.7rem; } .feedback { flex-direction: column; align-items: flex-start; } } </style>You can choose to delete existing cookies, allow or block third-party cookies, and set preferences for certain websites.
Cookies are files created by websites you visit. By saving information about your visit, they make your online experience easier. For example, sites can keep you signed in, remember your site preferences, and give you locally relevant content.
There are 2 types of cookies:
- First-party cookies: Created by the site you visit. The site is shown in the address bar.
- Third-party cookies: Created by other sites. A site you visit can embed content from other sites, for example images, ads, and text. Any of these sites can use third-party cookies to personalize content and ads, and learn about actions you take on other sites.
There are other ways that sites can personalize content and ads. Features like ad topics and site-suggested ads in Chrome allow sites to show you personalized content. These features limit what sites and their partners can learn about you. Learn more about managing these features.
- On your Android device, open Chrome Chrome.
- At the top right, tap More ⋮ Settings.
- Tap Privacy and security > Delete browsing data.
- Next to "Time range," from the dropdown menu, choose the browsing data time range you want to delete:
- Last 15 minutes
- Last hour
- Last 24 hours
- Last 7 days
- Last 4 weeks
- All time
- Check Cookies and site data.
- Check other items you want to delete.
- To confirm, tap Delete data.
- On your Android device, open Chrome Chrome.
- Go to a website.
- At the top left of the address bar, tap Page info 🔒 > Cookies and site data.
- Next to the stored data, tap Delete 🗑️.
If you block third-party cookies, some sites may not work as you expected. You can temporarily allow third-party cookies for a specific site you visit.
- On your Android device, open Chrome Chrome.
- In the address bar, at the top left:
- To allow third-party cookies: Tap Page info 🔒 > Cookies and site data and turn on Third-party cookies.
- To block third-party cookies: Tap Page info 🔒 > Cookies and site data and turn off Third-party cookies.
- This option is only temporary and only for the site you’re on.
- Sites get added to the exception list automatically.
- If you temporarily allow third-party cookies on a site, that setting carries over into Incognito mode and you can't reset it from Incognito mode.
A company can define a group of sites that are related to each other. For example, a company might want to keep you signed in as you move between acme-music.example and acme-video.example.
- If you allow third-party cookies: Allows related sites to access your activity to personalize content or keep you signed in across sites.
- If you block third-party cookies: It often prevents this kind of connection between sites. You can block third-party cookies while you allow sites in the same group to improve your experience.
You can find the full list of companies who define groups of related sites on Github. Learn more about related sites and third-party cookies.
To allow related sites to find your activity within the group:
- On your Android device, open Chrome Chrome.
- At the top right, tap More ⋮ Settings.
- Tap Privacy and security > Third-party cookies > Block third-party cookies.
- Tap the arrow next to "Block third-party cookies."
- Turn Allow related sites to see your activity in the group on or off.
To show related sites in the same group:
- On your Android device, open Chrome Chrome.
- At the top right, tap More ⋮ Settings.
- Tap Site settings > All sites.
- Choose a site.
- Under “Sites under [website link],” find sites in the same group.