refactoring handlers
This commit is contained in:
parent
59ab0940ae
commit
ab0b7a5385
12 changed files with 1098 additions and 25 deletions
43
apps/data-service/src/handlers/qm/shared/config.ts
Normal file
43
apps/data-service/src/handlers/qm/shared/config.ts
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
* Shared configuration for QM operations
|
||||
*/
|
||||
|
||||
import { getRandomUserAgent } from '@stock-bot/http';
|
||||
|
||||
// QM Session IDs for different endpoints
|
||||
export const QM_SESSION_IDS = {
|
||||
LOOKUP: 'dc8c9930437f65d30f6597768800957017bac203a0a50342932757c8dfa158d6', // lookup endpoint
|
||||
// Add other session IDs as needed
|
||||
} as const;
|
||||
|
||||
// QM API Configuration
|
||||
export const QM_CONFIG = {
|
||||
BASE_URL: 'https://app.quotemedia.com',
|
||||
AUTH_PATH: '/auth/g/authenticate/dataTool/v0/500',
|
||||
LOOKUP_URL: 'https://app.quotemedia.com/datatool/lookup.json',
|
||||
ORIGIN: 'https://www.quotemedia.com',
|
||||
REFERER: 'https://www.quotemedia.com/',
|
||||
} as const;
|
||||
|
||||
// Session management settings
|
||||
export const SESSION_CONFIG = {
|
||||
MIN_SESSIONS: 5,
|
||||
MAX_SESSIONS: 10,
|
||||
MAX_FAILED_CALLS: 10,
|
||||
SESSION_TIMEOUT: 10000, // 10 seconds
|
||||
API_TIMEOUT: 15000, // 15 seconds
|
||||
} as const;
|
||||
|
||||
/**
|
||||
* Generate standard QM headers
|
||||
*/
|
||||
export function getQmHeaders(): Record<string, string> {
|
||||
return {
|
||||
'User-Agent': getRandomUserAgent(),
|
||||
Accept: '*/*',
|
||||
'Accept-Language': 'en',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
Origin: QM_CONFIG.ORIGIN,
|
||||
Referer: QM_CONFIG.REFERER,
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue