Skip to main content

Coursera OAuth2 client

This project is a library consisting of a command-line interface and a client for interacting with Coursera’s OAuth2 authorizes APIs. It’s a rewritten courseraoauth2client with python3 support.

Installation

Create virtualenv using python3:

virtualenv -p $(which python3) <path_to_env>

Activate created virtualenv:

source <path_to_env>/bin/activate

To install this SDK, execute:

pip install coaclient

pip is a python package manager.

Setup

Before using Coursera’s OAuth2 APIs, be sure you know your client id, client secret, and scopes you want for your application. You may create an application at https://accounts.coursera.org/console. When creating the application, set the Redirect URI to be http://localhost:9876/callback.

Command Line Interface

The project includes a command-line tool. Run:

coaclient --help

for a complete list of features, flags, and documentation.

config

Configures the Coursera OAuth2 client library.

Examples:

coaclient config add --app APP_NAME

Adds configuration for a new application to coaclient. And also prepares new storage for application authorization tokens in coaclient.

coaclient config authorize --app APP_NAME

Configures the tool to go through the authorization secret flow for application APP.

The Coaclient tries to open the default system browser(If this step fails, the Coaclient suggests to open a link in the browser manually). The application configuration will be saved to the local file if the request is succeeded. You should check the data you’ve provided to the library during application configuration if you see any errors in the browser.

coaclient config check-auth --app APP_NAME

Checks whether the current instance can authorize against Coursera’s API server for application APP

coaclient config display-auth-cache --app APP_NAME

Shows authorization cache for app. The auth and refresh tokens are truncated for security purposes. If you want to display them, you can add --no-truncate option. Don’t pass your tokens to the third parties!

coaclient config delete --app APP_NAME

Delete the application from configuration file if the application exists.

version

Returns the current version of the library

Examples:

coaclient version

loglevel

You can suppress output or get more detailed information by choosing a log level. It can be done by specifying the optional --log-level(-l) parameter. Valid choices are INFO, DEBUG, WARNING, ERROR, CRITICAL. Default loglevel is INFO.

Usage

import requests
from coaclient import oauth2
...
app_name = 'my_application_name'
url = 'https://api.coursera.org/api/externalBasicProfiles.v1?q=me&fields=name'
auth = oauth2.build(app_name=app_name).authorizer
response = requests.get(url, auth=auth)
print(response.json())

If my_application_name was successfully configured, you will be able to successfully make a request. Otherwise, an exception will be thrown telling you to set up your application for API access.

Bugs / Issues / Feature Requests

Please use the Github issue tracker to document any bugs or other issues you encounter while using this tool.

Tests

To run tests, run: nosetests, or tox.

Metadata

Release files for coaclient 1.2.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 coaclient 1.2.0
File Size Uploaded Provenance Actions
coaclient-1.2.0.tar.gz 21.6 kB Without provenance Details for coaclient-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for coaclient 1.2.0
File Interpreter ABI Platform Actions
coaclient-1.2.0-py3-none-any.whl Python 3 none any Details for coaclient-1.2.0-py3-none-any.whl

Total release size: 47.5 kB

Release files / coaclient-1.2.0.tar.gz

Download URL coaclient-1.2.0.tar.gz
Size 21.6 kB
Tags Source
SHA-256 checksum
How to use checksums
82720ce866b7a46bf48baf42fc0fa1ea251bb41ce97c9ede6a98f115878d9a69
BLAKE2b-256 checksum
How to use checksums
23f9c37be8abf6f71870b9c025bf8990cf37c0c54932596c2e8c55bed870ae93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.5

Release files / coaclient-1.2.0-py3-none-any.whl

Download URL coaclient-1.2.0-py3-none-any.whl
Size 25.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae87e1103110d1f63bf530c840377713043f6625718a7fccdbf0ebec85842a86
BLAKE2b-256 checksum
How to use checksums
334e0d0298931346ae4527e70aeef2888e0b9f980905626c9ec956b2cadccda4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.5

Security for coaclient 1.2.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.

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