A web crawler library that fetches and parses data from Boston College Agora Portal
Project description
pygora
A web crawler library that fetches and parses data from BC Agora Portal.
Getting started (Python 3):
pip install pygora-phchcc
Examples
log in agora, download and print links to all subject pages
from pygora import *
session, gen_time = get_session("myAgoraUsername", "myAgoraPassword", check_valid=True)
# if gen_time == 0, we know something goes wrong (maybe you did not input the correct credential)
print(gen_time)
subjects = download_subjects(session, simple=True) # simple: each subject is a string
for i, line in enumerate(subjects):
print(i, line)
# subjects = download_subjects(session) #eacg subject is a dict, with more information
cache the username and password so that you don't have to write them explicitly in a script
from pygora import *
# to set credential, run it once so that username & password are stored locally
set_credential("myAgoraUsername", "myAgoraPassword")
# to clear out credential
set_credential("", "")
example of parse_subject_page: print out all biology courses (school and subject codes can be found in subject.txt), provided that if you have run set_credential
from pygora import *
session, gen_time = get_session(*get_credential(), check_valid=True)
# if you are confident that your username & password are correct, do
# session, gen_time = get_session(*get_credential())
url = SUBJECT_URL.format('2MCAS', '2BIOL') # get you a url string
resp = session.get(url) # use your session to HTTP get the url
courses = parse_subject_page(resp) # parse the subject page
for course in courses:
print(course)
example of parse_course_page: print all information on a course page (the course code can be found in the output of parse_subject_page)
from pygora import *
session, gen_time = get_session(*get_credential())
url = COURSE_URL.format('ACCT102101')
# a dummy dict in this example, could be your data fetched from database
info_dict = dict()
resp = session.get(url)
parse_course_page(resp, info_dict) # update the dict
for key, value in info_dict.items():
print(key, value)
Related Projects
the backend of EagleVision
the backend of New PEPS (planning)
Join Dev Team / Contact Us:
open an issue on Github to announce the feature/bug that you want to work on
or through email: (Haochen) phchcc_at_gmail_dot_com
or search our names in BC directory
Special Thanks
Special thanks to people who made EagleVision (this project's prototype) and pygora alive (names are listed in alphabetical order):
Baichuan (Patrick) Guo -- the original "Honest Team"
David Shen -- the EagleVision Dev Team
Estevan Feliz -- the original "Honest Team" & the EagleVision Dev Team
Roger Wang -- the EagleVision Dev Team
Yuning (Tommy) Yang -- the original "Honest Team"
Yuxuan (Jacky) Jin -- the EagleVision Dev Team
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pygora-phchcc-0.0.10.tar.gz.
File metadata
- Download URL: pygora-phchcc-0.0.10.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f124ea0220fd3c0fdc15b868a2bbc5b77e805ac4fdbf82128a7e3de3a3c9b1e9
|
|
| MD5 |
189fd932f29d599e08cd5d10eff8ae04
|
|
| BLAKE2b-256 |
f2cec241c64fb44a36e73ad732510cecce2300154683c84941b2646c2f75214a
|
File details
Details for the file pygora_phchcc-0.0.10-py3-none-any.whl.
File metadata
- Download URL: pygora_phchcc-0.0.10-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cabea8e8166018719c3dd9f0e9934fe1041ef1d1e2212c78f565243c5a1c9320
|
|
| MD5 |
c567b45edcdbc2312d6cd3d8ea03a527
|
|
| BLAKE2b-256 |
fe1b6b6f6d76a61e48d2c1ade68413602642d1ed1d8d45a3713e8264be86a012
|