Coder Social home page Coder Social logo

infinite-campus's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

infinite-campus's Issues

Insecure login method

Nice little lib. However, it's not best practice to transmit secure login credentials over http GET in the URL. Your username/password is exposed to anything listening to or logging URL traffic. Looks like a drop-in replacement to use the POST version of the same URL.

Example:

// _login() function around line 237
    request.post(this.district.district_baseurl + 'verify.jsp?nonBrowser=true',
      {
        form: {
          username,
          password,
          portalUrl: this.district.parent_login_url,
          appName: this.district.district_app_name,
        }
      },
      (err, res, body) => {
        try {
          errHandler.login.handle(err, res, body)
        } catch (err) {
          return this.emit('error', err)
        }
        resolve()
      });

Cheers

Custom instance support?

My district uses a self hosted instance of Infinite Campus, is this project compatible with that?

Some grades objects are undefined

Some courses work fine, but others are undefined despite being no different to others. I used the example code from the github page.

"Student Campus" broke everything

the new "Student Campus" broke how the API worked before as well as the format for the xml.

This comes with some good news though, student campus uses API calls to generate data client-side as opposed to server-generated HTML. This means that we can take a look at the network requests and find relevant API calls. Not only that, but we can ditch the terrible, horrible, no good, very bad XML file.

Courses without grades

Some courses don't have grades on campus, and this throws an error when getting courses.

"Username/Password is incorrect" error even when it is correct

I installed the "npm i infinite-campus" and I looked at the documentation and followed the all the code, but when I run the code it says this error:

/Users/Name/node_modules/reqjs-err-handler/index.js:131
throw new Error([${prefix}][${errPrefix}] ${text})
^

Error: [LOGIN][F_BODY_0] Username/Password is incorrect.
at ErrorHandler._throwErr (/Users/Name/node_modules/reqjs-err-handler/index.js:131:11)
at /Users/Name/node_modules/reqjs-err-handler/index.js:61:18
at Array.forEach ()
at ErrorHandler.handle (/Users/Name/node_modules/reqjs-err-handler/index.js:58:30)
at Request._callback (/Users/Name/node_modules/infinite-campus/index.js:207:26)
at Request.self.callback (/Users/Name/node_modules/request/request.js:185:22)
at Request.emit (events.js:315:20)
at Request. (/Users/Name/node_modules/request/request.js:1154:10)
at Request.emit (events.js:315:20)
at IncomingMessage. (/Users/Name/node_modules/request/request.js:1076:12)

This is my code:

const InfiniteCampus = require('infinite-campus')
const user = new InfiniteCampus('Atlanta', 'GA', 'ihamilto0684', 'XXXXX')

// wait until we are done logging in
user.on('ready', () => {
// now that we are logged in, fetch courses
user.getCourses().then((courses) => {
console.log(courses)
})
})

Error in line 318 (index.js)

When I am trying to run the demo application I am getting the notifications back however, the link is not valid in the notification ( link: 'https://utcloud1.infinitecampus.org/campus/undefinedundefined',)

Not only that looks like there is an error on line 318 (index.js) that is causing problems) #
Screen Shot 2022-10-23 at 6 13 49 PM
Screen Shot 2022-10-23 at 6 13 54 PM

`const InfiniteCampus = require('infinite-campus')
// log in District Name State Username Password
const user = new InfiniteCampus('xxxxx', 'xx', 'xxxxxxxx', 'xxxxxxxx')

// wait until we are done logging in
user.on('ready', () => {
// now that we are logged in...

// get grades from all courses, returns an array of terms containing class information (see docs)
user.getCourses().then((terms) => {
console.log(terms)
// [{name:"Q1", courses: [{name: "1 English", grades:{}, ...}, ...]}, ... ]
})

// get the last 20 notifications
user.getNotifications(20).then((notifications) => {
console.log(notifications)
// [{id: "1111", test: "BOB recieved a new grade of A", timestamp: 1234, read: false, ... }, ...]

// then mark all notifications as read
user.markAllNotificationsRead().then(() => {
    console.log('notifications marked as read...')
})

})

})

// listen for any errors thrown while logging in
user.on('error', (err) => {
console.log('Error while Logging in. Bad credentials.' + err)
})`

`grades` property returns `undefined`

Firstly, I'm quite honestly amazed and thankful for this API. If it weren't for this API, I was going to have to make a web scraper, and that would've taken a while! So, thank you @qwazwsx!

Now for the issue I'm having:
I created a new NodeJS project on Replit, and initialized a new instance of InfiniteCampus() with the necessary information. The login was successful, and I was able to programmatically view my courses. Wonderful! However, the one most crucial part of my project, the grades, returned undefined. Here's my current script:

const InfiniteCampus = require('infinite-campus'); 

const DISTRICT = process.env['DISTRICT']; 
const STATE = process.env['STATE']; 
const IC_USER = process.env['IC_USER']; 
const IC_PASS = process.env['IC_PASS']; 

const user = new InfiniteCampus(DISTRICT, STATE, IC_USER, IC_PASS); 

user.on('ready', () => {
    console.log("Login successful!"); 
    
    user.getCourses().then(terms => {
        console.log(terms[0].courses[0].grades); 
    }); 
}); 

Is there any specific reason this isn't working? Maybe something on Infinite Campus changed?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.