Crates.io | webweg |
lib.rs | webweg |
version | 0.9.2 |
source | src |
created_at | 2022-11-09 13:23:32.812985 |
updated_at | 2024-11-13 01:11:32.853531 |
description | An asynchronous API wrapper for UCSD's WebReg course enrollment system. |
homepage | https://github.com/ewang2002/webweg/ |
repository | https://github.com/ewang2002/webweg/ |
max_upload_size | |
id | 708772 |
size | 452,700 |
webweg | webreg_scraper | UCSDHistEnrollmentData
An asynchronous API wrapper for the University of California San Diego's WebReg course enrollment system.
To use this crate, run the following command:
cargo add webweg
Alternatively, you can also put the following line into your Cargo.toml
:
webweg = "0.9"
See the corresponding crates.io page for more information.
A lot of the things that you can do on WebReg can be done with this wrapper. For example, you're able to:
You're also able to do things like:
To see some examples, check out the examples
folder.
By default, the wrapper will assume an environment where it is used in a single thread or task. So, if you want to share
an instance of the wrapper across multiple threads or tasks, you would have to use a Mutex
. The problem with using a
Mutex
is that if a request is taking a long time (which isn't unusual), the entire wrapper is locked until the request
is finished, meaning the other threads using this instance of the wrapper must wait.
By enabling the multi
feature, the wrapper can be used across multiple threads or tasks without the need for a Mutex
.
To add this crate with the multi
feature, you can either run
cargo add webweg --features multi
or put
webweg = { version = "0.9", features = ["multi"] }
in your Cargo.toml
.
The way to provide authorization for this wrapper is to provide cookies from an active WebReg session (i.e., your authentication cookies).
To get your authentication cookies, you'll need to do the following:
https://act.ucsd.edu/webreg2/svc/wradapter
Fetch/XHR
.Keep in mind that your cookies will expire after either:
Thus, you will need to find some way to keep yourself logged into WebReg 24/7 if you want to perform continuous requests.
This crate comes with two definition files:
raw_types
types
Most wrapper methods will make use of return types which can be found in
types
. Very rarely will you need to use raw_types
;
the only time you will need to use raw_types
is if you're using
the search_courses
method.
Many tests here are focused on the parsing aspect of the wrapper, and not making the request itself. It is assumed that making the request should be relatively error-free.
This crate uses a versioning scheme that is roughly based on Semantic Versioning. For a version
MAJOR.MINOR.PATCH
MAJOR
version will be incremented when a very significant feature is added, or many non-backwards compatible changes are added, or a (one or more) significant non-backwards compatible change is addedMINOR
version will be incremented when a minor feature is added, or few (if any) minor non-backwards compatible changes are added.PATCH
version will be incremented when a minor enhancement/feature is added or a bug is fixed.I am not responsible for any damages or other issue(s) caused by any use of this wrapper. In other words, by using this wrapper, I am not responsible if you somehow get in trouble or otherwise run into problems.
Everything in this repository is licensed under the MIT license.