-
Notifications
You must be signed in to change notification settings - Fork 24
DOC: Windows api key #252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
DOC: Windows api key #252
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,28 +25,68 @@ requests directly to the Civis API. See the | |
| `full documentation <https://civis-python.readthedocs.io>`_ for more details. | ||
|
|
||
|
|
||
| Installation | ||
| ------------ | ||
| API Keys | ||
| -------- | ||
|
|
||
| Usage of ``civis-python`` requires a valid Civis Platform API key, which can | ||
| be created by following the instructions | ||
| `here <https://civis.zendesk.com/hc/en-us/articles/216341583-Generating-an-API-Key>`_. | ||
| API keys have a set expiration date and new keys will need to be created at | ||
| least every 30 days. ``civis-python`` will look for a ``CIVIS_API_KEY`` | ||
| environmental variable to access your API key, so after creating a new API key, | ||
| follow the steps below for your operating system to set up your environment. | ||
|
|
||
| 1. Get a Civis API key `(instructions) <https://civis.zendesk.com/hc/en-us/articles/216341583-Generating-an-API-Key>`_. | ||
| 2. Add a ``CIVIS_API_KEY`` environment variable. | ||
| 3. You can add the following to ``.bash_profile`` for bash:: | ||
| Linux / MacOS | ||
| ~~~~~~~~~~~~~ | ||
|
|
||
| 1. Add the following to ``.bash_profile`` for bash:: | ||
|
|
||
| export CIVIS_API_KEY="alphaNumericApiK3y" | ||
|
|
||
| 4. Source your ``.bash_profile`` | ||
| 5. Install the package:: | ||
| 2. Source your ``.bash_profile`` (or restart your terminal). | ||
|
|
||
| Windows 10 | ||
| ~~~~~~~~~~ | ||
|
|
||
| 1. Navigate to ``Settings`` -> type "environment" in search bar -> | ||
| ``Edit environment variables for your account``. This can also be found | ||
| in ``System Properties`` -> ``Advanced`` -> ``Environment Variables...``. | ||
| 2. In the user variables section, if ``CIVIS_API_KEY`` already exists in | ||
| the list of environment variables, click on it and press ``Edit...``. | ||
| Otherwise, click ``New..``. | ||
| 3. Enter CIVIS_API_KEY as the ``Variable name``. | ||
| 4. Enter your API key as the ``Variable value``. Your API key should look | ||
| like a long string of letters and numbers. | ||
|
|
||
|
|
||
| Installation | ||
| ------------ | ||
|
|
||
| After creating an API key and setting the ``CIVIS_API_KEY`` environmental | ||
| variable, install ``civis-python`` with:: | ||
|
|
||
| pip install civis | ||
|
|
||
| 6. Optionally, install ``pandas``, and ``pubnub`` to enable some functionality in ``civis-python``:: | ||
| Optionally, install ``pandas``, and ``pubnub`` to enable some functionality in ``civis-python``:: | ||
|
|
||
| pip install pandas | ||
| pip install pubnub | ||
|
|
||
| Installation of ``pandas`` will allow some functions to return ``DataFrame`` outputs. | ||
| Installation of ``pubnub`` will improve performance in all functions which | ||
| wait for a Civis Platform job to complete. | ||
| Installation of ``pandas`` will allow some functions to return ``DataFrame`` outputs. | ||
| Installation of ``pubnub`` will improve performance in all functions which | ||
| wait for a Civis Platform job to complete. | ||
|
|
||
| You can test your installation by running | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| import civis | ||
| client = civis.APIClient() | ||
| print(client.users.list_me()['username']) | ||
|
|
||
| If ``civis-python`` was installed correctly, this will print your Civis | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Civis" -> "Civis Platform" |
||
| Platform username. | ||
|
|
||
|
|
||
| Usage | ||
| ----- | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worth mentioning https://docs.microsoft.com/en-us/windows/wsl/install-win10, which in my opinion is the best way to use python in windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect users will already have a workflow for python on Windows before they install
civis. This is pretty cool, though.