Compare commits

..

No commits in common. "36829906d026aab7e486a15334732a1975daa13d" and "9f9ce9bd891102779704a0f5851488bff5404211" have entirely different histories.

6 changed files with 0 additions and 40 deletions

1
.gitignore vendored
View File

@ -160,4 +160,3 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
cache

View File

@ -1,5 +0,0 @@
{
"cSpell.words": [
"referer"
]
}

View File

@ -5,7 +5,6 @@ A Python library for simplified HTTP requests, featuring rate limiting, browser-
## ToDo
- [ ] basic structure
- [ ] caching
- [ ] add cloudscraper
## License

View File

@ -4,5 +4,3 @@ import pathlib
__name__ = "python_requests"
__folder__ = str(pathlib.Path(__file__).parent)
CACHE_DIRECTORY = "cache"

View File

@ -1,8 +1,6 @@
import argparse
import logging
from .connections import Connection
def cli():
parser = argparse.ArgumentParser(
@ -32,12 +30,5 @@ def cli():
)
c = Connection()
c.generate_headers()
print(c.session.headers)
if __name__ == "__main__":
cli()

View File

@ -1,22 +0,0 @@
from __future__ import annotations
from typing import Optional
import requests
from urllib.parse import urlparse, urlunsplit, ParseResult
class Connection:
def __init__(self, session: Optional[requests.Session] = None) -> None:
self.session = session if session is not None else requests.Session()
def generate_headers(self, referer: Optional[str] = None):
headers = {
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:139.0) Gecko/20100101 Firefox/139.0",
"Connection": "keep-alive",
"Accept-Language": "en-US,en;q=0.5",
}
if referer is not None:
headers["Referer"] = referer
self.session.headers.update(**headers)