Coder Social home page Coder Social logo

iracing-api's People

Contributors

themich4 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

jglanz zzm634

iracing-api's Issues

Login not working

Hi, and thanks for this library!
I just discovered it today and it is really useful.

When executing the /auth call with email and password, the call returns 'Invalid username or password'.
This is working on 0.1.11.

EDIT:
I have checked the call in the Development Tools and it seems that the password parameter is encoded in a different way between both versions. Hope this helps

Thanks!!

Albert

After login, subsequent calls causes 401 - Unauthorized

Hi!

I have an Electron app using the iracing-api library with 0.1.11 (0.1.12 login is not working).
After the /auth call is successful I try to execute a call (getCars, getTracks, ... ) and they return 401 - Unauthorized.

Some more details:

My httpClient method looks like this:

async login(loginDTO: LoginDTO): Promise<LoginResponseDTO> {
const iRClient = new IracingAPI();
await iRClient.login(loginDTO.email, loginDTO.password);
await iRClient.getSeriesSeasons();
... more stuff in here
}

If you need any more info please let me know. Thanks!

Albert

Remove dependency on deasync

deasync is hack. It's a bad package and a bad idea. And it causes build problems when used on different machines and under different circumstances because it is a hack.

I know that tough-cookie seems to rely on it, but if tough-cookie needs deasync to work at runtime, then it too is a bad package and should be avoided.

Getting started using the API

Hello, and first of all, thanks for writing this API.

I know it is still a WIP, but I'd like to use it in an Express project.

Can you help me get started with it?

How do you import it, log in and send a simple request?

This is what I've come up with, but I can't even manage to import your module correctly.

const express = require('express');
import {IracingAPI} from "iracing-api/lib/index.js";

const app = express();
const port = 3000;
const irUser = '[email protected]';
const irPass = 'BAR';

app.get('/', (req, res) => {
  IracingAPI.login(irUser, irPass);
  res.send('Hello World!');
});

fetching data is still pretty broken

Requests without parameters work okay, but ones that accept parameters don't work because you're adding them to the body of a GET request instead of the query string.

Also, you're setting values in some parameters explicitly to "undefined", instead of not setting them at all, which is slightly different when it comes to enumerating properties of an object.

I've been using yarn to patch version 0.2.0 to get it to work. Here's the patch file if you want to see the changes I've made.
iracing-api-npm-0.2.0-6a3a5f6df8.patch

edit: lol, there's even a bug in my patch, because I wasn't sure if params could be null. Oh well, I think you can get the gist of it from this patch.

Handle iracing maintenance

IRacing maintenance is currently not handled.

API returns following object in case of maintenance:

{
  error: "Site Maintenance",
  note: "The site is currently undergoing maintenance. Please try your request later.",
}

Return metadata in getLeagueDirectory

In a previous revision (like 0.1.11 or something around there) getLeagueDirectory would return the raw result from the iRacing API, which included some metadata like the total count, offset, and size of results. I was making use of this extra to show progress and pagination stuff to the user. The new API just returns League[], which seems more useful at first, but throws away the pagination metadata.

For this endpoint, and presumably others that work on pages, it would be better to return an object with the metadata intact

use "node-fetch" to support node16

Amazon Linux 2 (for ec2 instances) only support node 16. The latest version of helper.js uses bare fetch which is only supported in node 18 and above.

the package node-fetch can be used to backfill fetch for node 16.

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.