themich4 / iracing-api Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://iracing-api.dyczkowski.dev
Home Page: https://iracing-api.dyczkowski.dev
import { API_URL } from "./consts";
ought to be import { API_URL } from "./consts.js";
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
Not sure what you've been using to define the iRacing API response types, but if you've been writing them all by hand, consider using https://app.quicktype.io/ instead to quickly generate type definitions from the JSON responses.
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
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.
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
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.",
}
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!');
});
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.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.