Skip to main content

Python library for scraping viggo assignments

Project description

Viggoscrape.py

Python library for scraping Viggo assignments by interacting with the Viggoscrape API.

The API is designed for danish users, and time will be adjusted to the CET timezone.

Quickstart

Information syntax

To use Viggoscrape.py, you need to provide it with login info in the form of a dictionary.

The login info uses 3 pieces of information:

  • Subdomain
  • Username
  • Password

For your subdomain, specify only the subdomain, like this:

subdomain-example

And not like this:

subdomain-example.viggo.dk

Usage example

Let's try this out! We'll import the library, give it the required info and print the result, catching any error that may happen.

from viggoscrape import get_assignments

try:
    data = get_assignments(
        {
            "subdomain": "example-subdomain",
            "username": "johndoe@gmail.com",
            "password": "Password1234"
        }
    )
    print(data)
except Exception as e:
    print(e)

Our output would look something like this:

{
    "subject": ["English", "Math"],
    "time": ["31. aug 12:00", "2. sep 08:55"],
    "description": ["Read pages 30 and 31", "Finish A, B and C"],
    "author": ["28. aug 11:25 by John Doe", "31. aug 15:30 by Peter Anker"],
    "files": ["None", "example.com/algebra.pdf"],
    "file_names": ["None", "Intro to algebra"],
    "url": ["https://example-subdomain.viggo.dk/Basic/HomeworkAndAssignment/Details/1234/#modal", "https://example-subdomain.viggo.dk/Basic/HomeworkAndAssignment/Details/1235/#modal"]
}

Or if something went wrong and the provided subdomain is invalid:

"Invalid subdomain"

Or if the password or username is misspelt:

"Invalid credentials"

Now, you can do anything you want with this newfound data, like save it to a json file, create an embed for your discord bot, or any other purpose. Just use the same index on all lists and the data should match.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

viggoscrape-1.2.2-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file viggoscrape-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: viggoscrape-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.3

File hashes

Hashes for viggoscrape-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f0a44faff135b228313e610256523ec7963b4c4626d77b3acfc118435a0902a3
MD5 985f48fd0b6d0a2a44102dc1b22dc9b2
BLAKE2b-256 e5c474926ae451b20e95be3076909528a33d5936ad20a11f0d25e923e01bbe24

See more details on using hashes here.

Supported by

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