Skip to content

Commit b934b76

Browse files
authored
DOC: Windows api key (civisanalytics#252)
* DOC: Adding documentation for windows users * fixing syntax in README * fixing link in readme * DOC: Clarifications in the README * Updating changelog
1 parent 60a86aa commit b934b76

File tree

2 files changed

+53
-11
lines changed

2 files changed

+53
-11
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
66
### Fixed
77

88
### Added
9+
- Added instructions in the README for adding an API key to a Windows 10
10+
environment
911

1012
### Changed
1113

README.rst

Lines changed: 51 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,68 @@ requests directly to the Civis API. See the
2525
`full documentation <https://civis-python.readthedocs.io>`_ for more details.
2626

2727

28-
Installation
29-
------------
28+
API Keys
29+
--------
30+
31+
Usage of ``civis-python`` requires a valid Civis Platform API key, which can
32+
be created by following the instructions
33+
`here <https://civis.zendesk.com/hc/en-us/articles/216341583-Generating-an-API-Key>`_.
34+
API keys have a set expiration date and new keys will need to be created at
35+
least every 30 days. ``civis-python`` will look for a ``CIVIS_API_KEY``
36+
environmental variable to access your API key, so after creating a new API key,
37+
follow the steps below for your operating system to set up your environment.
3038

31-
1. Get a Civis API key `(instructions) <https://civis.zendesk.com/hc/en-us/articles/216341583-Generating-an-API-Key>`_.
32-
2. Add a ``CIVIS_API_KEY`` environment variable.
33-
3. You can add the following to ``.bash_profile`` for bash::
39+
Linux / MacOS
40+
~~~~~~~~~~~~~
41+
42+
1. Add the following to ``.bash_profile`` for bash::
3443

3544
export CIVIS_API_KEY="alphaNumericApiK3y"
3645

37-
4. Source your ``.bash_profile``
38-
5. Install the package::
46+
2. Source your ``.bash_profile`` (or restart your terminal).
47+
48+
Windows 10
49+
~~~~~~~~~~
50+
51+
1. Navigate to ``Settings`` -> type "environment" in search bar ->
52+
``Edit environment variables for your account``. This can also be found
53+
in ``System Properties`` -> ``Advanced`` -> ``Environment Variables...``.
54+
2. In the user variables section, if ``CIVIS_API_KEY`` already exists in
55+
the list of environment variables, click on it and press ``Edit...``.
56+
Otherwise, click ``New..``.
57+
3. Enter CIVIS_API_KEY as the ``Variable name``.
58+
4. Enter your API key as the ``Variable value``. Your API key should look
59+
like a long string of letters and numbers.
60+
61+
62+
Installation
63+
------------
64+
65+
After creating an API key and setting the ``CIVIS_API_KEY`` environmental
66+
variable, install ``civis-python`` with::
3967

4068
pip install civis
4169

42-
6. Optionally, install ``pandas``, and ``pubnub`` to enable some functionality in ``civis-python``::
70+
Optionally, install ``pandas``, and ``pubnub`` to enable some functionality in ``civis-python``::
4371

4472
pip install pandas
4573
pip install pubnub
4674

47-
Installation of ``pandas`` will allow some functions to return ``DataFrame`` outputs.
48-
Installation of ``pubnub`` will improve performance in all functions which
49-
wait for a Civis Platform job to complete.
75+
Installation of ``pandas`` will allow some functions to return ``DataFrame`` outputs.
76+
Installation of ``pubnub`` will improve performance in all functions which
77+
wait for a Civis Platform job to complete.
78+
79+
You can test your installation by running
80+
81+
.. code-block:: python
82+
83+
import civis
84+
client = civis.APIClient()
85+
print(client.users.list_me()['username'])
86+
87+
If ``civis-python`` was installed correctly, this will print your Civis
88+
Platform username.
89+
5090

5191
Usage
5292
-----

0 commit comments

Comments
 (0)