mirror of
https://github.com/NexVeridian/ark-invest-api-rust-data.git
synced 2025-09-02 18:09:12 +00:00
header
This commit is contained in:
parent
d47e5ba9a8
commit
fde3840474
2 changed files with 9 additions and 26 deletions
0
.ignore
0
.ignore
35
src/util.rs
35
src/util.rs
|
@ -5,8 +5,6 @@ use polars::datatypes::DataType;
|
||||||
use polars::lazy::dsl::StrptimeOptions;
|
use polars::lazy::dsl::StrptimeOptions;
|
||||||
use polars::prelude::*;
|
use polars::prelude::*;
|
||||||
use reqwest::blocking::Client;
|
use reqwest::blocking::Client;
|
||||||
use reqwest::header;
|
|
||||||
use reqwest::header::{HeaderMap, HeaderValue};
|
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
use std::fs::{create_dir_all, File};
|
use std::fs::{create_dir_all, File};
|
||||||
use std::io::Cursor;
|
use std::io::Cursor;
|
||||||
|
@ -413,22 +411,22 @@ impl Ark {
|
||||||
.str()
|
.str()
|
||||||
.replace_all(lit("(?i) fp| uq| un| uw | cn"), lit(""), false)
|
.replace_all(lit("(?i) fp| uq| un| uw | cn"), lit(""), false)
|
||||||
.str()
|
.str()
|
||||||
.replace(lit("DKNN"), lit("DKNG"), true)
|
.replace(lit("DKNN"), lit("DKNG"), true),
|
||||||
.str()
|
// .str()
|
||||||
.strip_chars(lit("None")),
|
// .strip_chars(lit("None")),
|
||||||
);
|
);
|
||||||
expressions.push(
|
expressions.push(
|
||||||
col("company")
|
col("company")
|
||||||
.str()
|
// .str()
|
||||||
.replace_all(lit(r"(?i:-A| ADR| A| Cl| Class| Inc| incorporated| Ltd| Corp| Corporation| C| Cl| SE| Hold| Holdings| International|,|\.|-)"), lit(""), false)
|
// .replace_all(lit(r"(?i: incorporated| corporation| holdings| international|,|\.|-)"), lit(""), false)
|
||||||
.str()
|
.str()
|
||||||
.replace(lit("(?i)Coinbase Global"), lit("Coinbase"), false)
|
.replace(lit("(?i)Coinbase Global"), lit("Coinbase"), false)
|
||||||
.str()
|
.str()
|
||||||
.replace(lit("Blackdaemon"), lit("Blockdaemon"), true)
|
.replace(lit("Blackdaemon"), lit("Blockdaemon"), true)
|
||||||
.str()
|
.str()
|
||||||
.replace(lit("DISCOVERY"), lit("Dassault Systemes"), true)
|
.replace(lit("DISCOVERY"), lit("Dassault Systemes"), true),
|
||||||
.str()
|
// .str()
|
||||||
.strip_chars(lit("None")),
|
// .strip_chars(lit("None")),
|
||||||
);
|
);
|
||||||
|
|
||||||
// run expressions
|
// run expressions
|
||||||
|
@ -563,23 +561,8 @@ pub enum Reader {
|
||||||
|
|
||||||
impl Reader {
|
impl Reader {
|
||||||
pub fn get_data_url(&self, url: String) -> Result<DataFrame, Error> {
|
pub fn get_data_url(&self, url: String) -> Result<DataFrame, Error> {
|
||||||
let mut headers = HeaderMap::new();
|
|
||||||
headers.insert(
|
|
||||||
header::USER_AGENT,
|
|
||||||
HeaderValue::from_static("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"),
|
|
||||||
);
|
|
||||||
|
|
||||||
headers.insert(
|
|
||||||
header::ACCEPT,
|
|
||||||
HeaderValue::from_static("text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8"),
|
|
||||||
);
|
|
||||||
headers.insert(
|
|
||||||
header::ACCEPT_LANGUAGE,
|
|
||||||
HeaderValue::from_static("en-US,en;q=0.8"),
|
|
||||||
);
|
|
||||||
|
|
||||||
let response = Client::builder()
|
let response = Client::builder()
|
||||||
.default_headers(headers)
|
.user_agent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36")
|
||||||
.gzip(true)
|
.gzip(true)
|
||||||
.build()?
|
.build()?
|
||||||
.get(url)
|
.get(url)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue