Skip to main content
flickr-views-counter
====================

Python script to count the total number of views across all of a user's photos. Flickr's API doesn't give a total photo count anymore, so this script makes use of [this very helpful library](http://stuvel.eu/flickrapi) to add up the counts for each photo and output the total number of views for a user.

##Steps to setup script
1. Get a [**Non-commercial** Flickr API key](https://www.flickr.com/services/apps/create/noncommercial/?).
- Fill out the form
- Keep the page with your new *key* and *secret* open, you'll need them in a moment
1. Install [Python](https://www.python.org/downloads/), if you don't have it
1. Use pip to install the **flickr-views-counter** package

```bash
pip install flickr-views-counter
```

##Running the script
Run the script with your **user id**. For example, my user id is `26119226@N04`, which is the last part of the url for my photostream [https://www.flickr.com/photos/26119226@N04/](https://www.flickr.com/photos/26119226@N04/).

So, I would run (replacing the Xs with my API key and the Ys with my API secret):
```bash
flickr-views-counter 26119226@N04 --key XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --secret YYYYYYYYYYYYYYYYYYYYYYY
```
###Storing API key and secret
If you don't want to use your key and secret every time you run the script, you can store them in environment variables. Make sure you use **FLICKR_API_KEY** to store the key and **FLICKR_API_SECRET** to store the secret. [This guide](http://www.schrodinger.com/kb/1842) may be helpful for setting environment variables.


###Saving detailed data

If you want to save the data for your photos in csv format, then add an output file name. For example:
```bash
flickr-views-counter 26119226@N04 --output photo-views.csv
```
###Get daily stats
If you're familiar with crontab, you can set the script up to save your daily photo statistics. Here is an example that would run at noon every day, write the csv output to a folder with the date stamp, and log the total counts. The actual implementation would vary slightly based on your paths, and, of course, your user id.

```bash
00 12 * * * flickr-views-counter 26119226@N04 --output ~/Desktop/flickr-counts/count-views-$(date +%F).csv >> ~/Desktop/flickr-counts/flickr-counts-log.txt
```

### Options

#### -h, --help
Prints help message.

#### --output
Name of the output csv file to save photo data. Like, `photo-views.csv`

#### --key
Your [Flickr API](https://www.flickr.com/services/apps/create/noncommercial/?) key

#### --secret
Your [Flickr API](https://www.flickr.com/services/apps/create/noncommercial/?) secret

## FAQ
**Q: why isn't there a website to do this for me?**
*A: The FlickrApi is [rate limited](https://developer.yahoo.com/forum/YQL/What-is-the-maximum-flickr-API/1361494903655-6a1e3a51-cd41-411e-86a9-dc2dee898ab5/) to 3600 queries per house, so a single API key wouldn't be able to handle requests for a large number of users*

CHANGES
=======


0.1.0 (2015-06-02)
------------------

- Initial release.

Metadata

Release files for flickr-views-counter 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flickr-views-counter 0.1.0
File Size Uploaded Provenance Actions
flickr-views-counter-0.1.0.tar.gz 4.2 kB Without provenance Details for flickr-views-counter-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for flickr-views-counter 0.1.0
File Interpreter ABI Platform Actions
flickr_views_counter-0.1.0-py2.py3-none-any.whl Python 2, Python 3 none any Details for flickr_views_counter-0.1.0-py2.py3-none-any.whl

Total release size: 11.5 kB

Release files / flickr-views-counter-0.1.0.tar.gz

Download URL flickr-views-counter-0.1.0.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
24eeec8ed815ed4016ce058a56b545061d7b4e86877530345b666bc36fcb8529
BLAKE2b-256 checksum
How to use checksums
df0291a3fb81290cbabff6217acdfac41335d04cf432508e8429bf8020589157
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / flickr_views_counter-0.1.0-py2.py3-none-any.whl

Download URL flickr_views_counter-0.1.0-py2.py3-none-any.whl
Size 7.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
7df5f2ea1666b00fb6ed461893c765c61d200c41c197925399e8eab0a449077f
BLAKE2b-256 checksum
How to use checksums
dcd41190682afe1bf5ab550ff89542d65ffbbe82d983716a0b42f496c6cc7966
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for flickr-views-counter 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page