Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 4 additions & 3 deletions twitter_openapi_python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "twitter_openapi_python"
version = "0.0.41"
version = "0.0.43"
description = "Twitter OpenAPI"
authors = ["fa0311 <[email protected]>"]
license = "proprietary" # or "AGPL-3.0-only"
Expand All @@ -13,10 +13,11 @@ include = ["twitter_openapi_python/py.typed"]
[tool.poetry.dependencies]
python = "^3.7"
pydantic = ">=2.6"
requests = ">=2.31.0,<3.0.0"
urllib3 = ">= 2.1.0 < 3.0.0"
xclienttransaction = ">= 1.0.0 < 2.0.0"

twitter-openapi-python-generated = "0.0.33"
twitter-openapi-python-generated = "0.0.34"

[tool.poetry.dev-dependencies]

Expand All @@ -32,4 +33,4 @@ reportPrivateImportUsage = false
typeCheckingMode = "standard"

[tool.ruff]
line-length = 120
line-length = 120
Binary file modified twitter_openapi_python/requirements.txt
Binary file not shown.
7 changes: 4 additions & 3 deletions twitter_openapi_python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
from setuptools import find_packages, setup

NAME = "twitter_openapi_python"
VERSION = "0.0.41"
VERSION = "0.0.43"
PYTHON_REQUIRES = ">=3.7"
REQUIRES = [
"twitter_openapi_python_generated == 0.0.33",
"twitter_openapi_python_generated == 0.0.34",
"pydantic >= 2.6",
"requests >= 2.31.0, < 3.0.0",
"urllib3 >= 2.1.0, < 3.0.0",
"xclienttransaction >= 1.0.0, < 2.0.0"
"xclienttransaction >= 1.0.0, < 2.0.0",
]
GITHUB_RAW_URL = (
"https://raw.githubusercontent.com/fa0311/twitter_openapi_python/refs/heads/master/twitter_openapi_python/"
Expand Down
14 changes: 7 additions & 7 deletions twitter_openapi_python/twitter_openapi_python/models/header.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Dict
from typing import Dict, Optional

from pydantic import Field

Expand All @@ -7,14 +7,14 @@

class ApiUtilsHeader(BaseModel):
raw: Dict[str, str] = Field()
connection_hash: str = Field()
content_type_options: str = Field()
frame_options: str = Field()
connection_hash: Optional[str] = Field()
content_type_options: Optional[str] = Field()
frame_options: Optional[str] = Field()
response_time: int = Field()
tfe_preserve_body: bool = Field()
transaction_id: str = Field()
xss_protection: int = Field()
transaction_id: Optional[str] = Field()
xss_protection: Optional[int] = Field()
rate_limit_limit: int = Field()
rate_limit_remaining: int = Field()
rate_limit_reset: int = Field()
twitter_response_tags: str = Field()
twitter_response_tags: Optional[str] = Field()
2 changes: 1 addition & 1 deletion twitter_openapi_python/twitter_openapi_python/tid.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ def get_tid():
home_page_response = bs4.BeautifulSoup(home_page.content, "html.parser")
ondemand_file_url = get_ondemand_file_url(response=home_page_response)
ondemand_file = session.get(url=ondemand_file_url) # type: ignore
ondemand_file_response = bs4.BeautifulSoup(ondemand_file.content, "html.parser")
ondemand_file_response = ondemand_file.text
ct = ClientTransaction(home_page_response=home_page_response, ondemand_file_response=ondemand_file_response)
return ct
14 changes: 7 additions & 7 deletions twitter_openapi_python/twitter_openapi_python/utils/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,17 +256,17 @@ def find_fn_2(x: models.TimelineTimelineCursor) -> bool:
def build_header(headers: Dict[str, str]) -> ApiUtilsHeader:
return ApiUtilsHeader(
raw=headers,
connection_hash=headers["x-connection-hash"],
content_type_options=headers["x-content-type-options"],
frame_options=headers["x-frame-options"],
connection_hash=headers.get("x-connection-hash"),
content_type_options=headers.get("x-content-type-options"),
frame_options=headers.get("x-frame-options"),
rate_limit_limit=int(headers.get("x-rate-limit-limit", 0)),
rate_limit_remaining=int(headers.get("x-rate-limit-remaining", 0)),
rate_limit_reset=int(headers.get("x-rate-limit-reset", 0)),
response_time=int(headers["x-response-time"]),
response_time=int(headers.get("x-response-time", 0)),
tfe_preserve_body=headers.get("x-tfe-preserve-body") == "true",
transaction_id=headers["x-transaction-id"],
twitter_response_tags=headers["x-twitter-response-tags"],
xss_protection=int(headers["x-xss-protection"]),
transaction_id=headers.get("x-transaction-id"),
twitter_response_tags=headers.get("x-twitter-response-tags"),
xss_protection= int(headers["x-xss-protection"]) if headers.get("x-xss-protection") is not None else None,
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ name: twitter_openapi_python_generated Python package

on: [push, pull_request]

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion twitter_openapi_python_generated/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ docs/_build/
# PyBuilder
target/

#Ipython Notebook
# Ipython Notebook
.ipynb_checkpoints
12 changes: 6 additions & 6 deletions twitter_openapi_python_generated/.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ stages:
- pip install -r test-requirements.txt
- pytest --cov=twitter_openapi_python_generated

pytest-3.8:
extends: .pytest
image: python:3.8-alpine
pytest-3.9:
extends: .pytest
image: python:3.9-alpine
pytest-3.10:
extends: .pytest
image: python:3.10-alpine
Expand All @@ -29,3 +23,9 @@ pytest-3.11:
pytest-3.12:
extends: .pytest
image: python:3.12-alpine
pytest-3.13:
extends: .pytest
image: python:3.13-alpine
pytest-3.14:
extends: .pytest
image: python:3.14-alpine
Loading