Skip to main content

An API wrapper for Stack Overflow for Teams

Project description

Stack Overflow for Teams API Wrapper (so4t_api_wrapper)

A Python wrapper for the Stack Overflow for Teams API, replicating the functionality of the Stack Overflow for Teams API in a more user-friendly way.

Full documentation for the API can be found at one of the following locations:

Table of Contents

Setup

Install

Install the package using pip:

python3 -m pip install so4t_api

If you're running Windows, you'll probably need to use py instead of python3

API Authentication

To authenticate with the Stack Overflow API, you will need to generate a valid access token.

NOTE: For Enterprise, if you'll be performing any API tasks that require posting or editing content (i.e. anything beyond just getting/reading content), you'll need to make sure to include the write_access scope when generating your token; otherwise, you will not be able to make the necessary updates to content via the API.

ANOTHER NOTE: For Enterprise, if you'll be using any of the impersonation methods, this will additionally require an API key, which will be submitted as an argument when instantiating StackClient. It will also require enabling impersonation, which involves sending a request to support@stackoverflow.com.

Usage

A basic example of how to use the wrapper in an application:

import os
from so4t_api import StackClient

# instantiate the StackClient
stack = StackClient(url=os.environ["SO_URL"], token=os.environ["SO_TOKEN"]) 

# get all questions
questions = stack.get_questions() 

# Calculate total page views
total_views = 0
for question in questions:
    total_views += question["viewCount"]
print(f"Total page views across {len(questions)} questions: {total_views}")

At this time, most/all the documentation for wrapper methods is documented along side the methods (i.e. in the code)

Support

Disclaimer: the creator of this project works at Stack Overflow, but it is a labor of love that comes with no formal support from Stack Overflow.

If you run into issues using the script, please open an issue. You are also welcome to edit the script to suit your needs, steal the code, or do whatever you want with it.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

so4t_api-0.1.0.tar.gz (30.9 kB view details)

Uploaded Source

Built Distribution

so4t_api-0.1.0-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

Details for the file so4t_api-0.1.0.tar.gz.

File metadata

  • Download URL: so4t_api-0.1.0.tar.gz
  • Upload date:
  • Size: 30.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.3

File hashes

Hashes for so4t_api-0.1.0.tar.gz
Algorithm Hash digest
SHA256 932073a770e79cad528b0f758dedb6b7101ae35c4835da94c658314c50a2c871
MD5 c35301ba182b04b026c48fcc23102f49
BLAKE2b-256 31961cd1e7c9643221b6a26048a535450163a1e95fe5708adfd08e1e40d7ab04

See more details on using hashes here.

File details

Details for the file so4t_api-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: so4t_api-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.3

File hashes

Hashes for so4t_api-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e0319ec9ab8592cf37aaadd3361a8b622c4ea5bdeae5d7673c86544ca42d370c
MD5 77348b2214fdf165a4d269820bb4467a
BLAKE2b-256 2338e6e9d95e6e873ba371c5c4c31d51418e7f59d77b519ca0870f609cfc70e4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page