Skip to main content

Python library for scraping viggo assignments

Project description

Viggoscrape

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, 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 Distribution

viggoscrape-1.2.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

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

viggoscrape-1.2.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file viggoscrape-1.2.0.tar.gz.

File metadata

  • Download URL: viggoscrape-1.2.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.0 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

File hashes

Hashes for viggoscrape-1.2.0.tar.gz
Algorithm Hash digest
SHA256 43a049e45fb0377fac22090814c6c39b1bcf4275a2ae15712c5f9c400c546a1f
MD5 96c3c8992b00160a062c3a54634209a8
BLAKE2b-256 7ebd167b1df89e39b54d5b8508055fa59f836db36b1fc46446786b20f9760f3a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: viggoscrape-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.0 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

File hashes

Hashes for viggoscrape-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 de245d5b237f47976932bcd5a101548854fed2f9183d31e87b8f6577843c163a
MD5 532750bbc4fac23bc0a53c5119d75a40
BLAKE2b-256 6fed7ef5e7147e754227db9b21f9a27d86832c2fd3a689cf5ca9fb5493e3fc3e

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