twitter-cli 0.4.1__tar.gz → 0.4.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. {twitter_cli-0.4.1 → twitter_cli-0.4.2}/PKG-INFO +1 -1
  2. {twitter_cli-0.4.1 → twitter_cli-0.4.2}/pyproject.toml +1 -1
  3. {twitter_cli-0.4.1 → twitter_cli-0.4.2}/tests/test_client.py +17 -0
  4. {twitter_cli-0.4.1 → twitter_cli-0.4.2}/twitter_cli/client.py +8 -2
  5. {twitter_cli-0.4.1 → twitter_cli-0.4.2}/uv.lock +1 -1
  6. {twitter_cli-0.4.1 → twitter_cli-0.4.2}/.github/workflows/ci.yml +0 -0
  7. {twitter_cli-0.4.1 → twitter_cli-0.4.2}/.github/workflows/publish-clawhub.yml +0 -0
  8. {twitter_cli-0.4.1 → twitter_cli-0.4.2}/.github/workflows/publish.yml +0 -0
  9. {twitter_cli-0.4.1 → twitter_cli-0.4.2}/.gitignore +0 -0
  10. {twitter_cli-0.4.1 → twitter_cli-0.4.2}/LICENSE +0 -0
  11. {twitter_cli-0.4.1 → twitter_cli-0.4.2}/README.md +0 -0
  12. {twitter_cli-0.4.1 → twitter_cli-0.4.2}/SKILL.md +0 -0
  13. {twitter_cli-0.4.1 → twitter_cli-0.4.2}/config.yaml +0 -0
  14. {twitter_cli-0.4.1 → twitter_cli-0.4.2}/tests/conftest.py +0 -0
  15. {twitter_cli-0.4.1 → twitter_cli-0.4.2}/tests/test_cli.py +0 -0
  16. {twitter_cli-0.4.1 → twitter_cli-0.4.2}/tests/test_config.py +0 -0
  17. {twitter_cli-0.4.1 → twitter_cli-0.4.2}/tests/test_config_normalization.py +0 -0
  18. {twitter_cli-0.4.1 → twitter_cli-0.4.2}/tests/test_filter.py +0 -0
  19. {twitter_cli-0.4.1 → twitter_cli-0.4.2}/tests/test_serialization.py +0 -0
  20. {twitter_cli-0.4.1 → twitter_cli-0.4.2}/twitter_cli/__init__.py +0 -0
  21. {twitter_cli-0.4.1 → twitter_cli-0.4.2}/twitter_cli/auth.py +0 -0
  22. {twitter_cli-0.4.1 → twitter_cli-0.4.2}/twitter_cli/cli.py +0 -0
  23. {twitter_cli-0.4.1 → twitter_cli-0.4.2}/twitter_cli/config.py +0 -0
  24. {twitter_cli-0.4.1 → twitter_cli-0.4.2}/twitter_cli/constants.py +0 -0
  25. {twitter_cli-0.4.1 → twitter_cli-0.4.2}/twitter_cli/filter.py +0 -0
  26. {twitter_cli-0.4.1 → twitter_cli-0.4.2}/twitter_cli/formatter.py +0 -0
  27. {twitter_cli-0.4.1 → twitter_cli-0.4.2}/twitter_cli/models.py +0 -0
  28. {twitter_cli-0.4.1 → twitter_cli-0.4.2}/twitter_cli/serialization.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: twitter-cli
3
- Version: 0.4.1
3
+ Version: 0.4.2
4
4
  Summary: A CLI for Twitter/X — feed, bookmarks, and user timeline in terminal
5
5
  Project-URL: Homepage, https://github.com/jackwener/twitter-cli
6
6
  Project-URL: Repository, https://github.com/jackwener/twitter-cli
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "twitter-cli"
7
- version = "0.4.1"
7
+ version = "0.4.2"
8
8
  description = "A CLI for Twitter/X — feed, bookmarks, and user timeline in terminal"
9
9
  readme = "README.md"
10
10
  license = "Apache-2.0"
@@ -176,6 +176,23 @@ class TestBuildGraphqlUrl:
176
176
  url = _build_graphql_url("x", "Op", {}, {}, {"toggle": True})
177
177
  assert "fieldToggles=" in url
178
178
 
179
+ def test_false_features_omitted_from_url(self):
180
+ """False-valued features should be omitted to keep URL short (avoid 414)."""
181
+ features = {"enabled_flag": True, "disabled_flag": False, "another_enabled": True}
182
+ url = _build_graphql_url("q", "Op", {}, features)
183
+ assert "enabled_flag" in url
184
+ assert "another_enabled" in url
185
+ assert "disabled_flag" not in url
186
+
187
+ def test_url_length_with_full_features(self):
188
+ """URL with full FEATURES dict should stay under 8000 chars (server limit)."""
189
+ url = _build_graphql_url(
190
+ "abc123", "SearchTimeline",
191
+ {"rawQuery": "AI agent", "querySource": "typed_query", "product": "Latest", "count": 50},
192
+ FEATURES,
193
+ )
194
+ assert len(url) < 8000, f"URL too long: {len(url)} chars"
195
+
179
196
 
180
197
  # ── _best_chrome_target ──────────────────────────────────────────────────
181
198
 
@@ -164,12 +164,18 @@ def _url_fetch(url, headers=None):
164
164
 
165
165
  def _build_graphql_url(query_id, operation_name, variables, features, field_toggles=None):
166
166
  # type: (str, str, Dict[str, Any], Dict[str, Any], Optional[Dict[str, Any]]) -> str
167
- """Build GraphQL GET URL with encoded variables/features/fieldToggles."""
167
+ """Build GraphQL GET URL with encoded variables/features/fieldToggles.
168
+
169
+ Only includes True-valued feature flags in the URL to avoid 414 URI Too Long.
170
+ Twitter's API defaults missing features to False.
171
+ """
172
+ # Compact features: omit False values to keep URL under server limits
173
+ compact_features = {k: v for k, v in features.items() if v is not False}
168
174
  url = "https://x.com/i/api/graphql/%s/%s?variables=%s&features=%s" % (
169
175
  query_id,
170
176
  operation_name,
171
177
  urllib.parse.quote(json.dumps(variables, separators=(",", ":"))),
172
- urllib.parse.quote(json.dumps(features, separators=(",", ":"))),
178
+ urllib.parse.quote(json.dumps(compact_features, separators=(",", ":"))),
173
179
  )
174
180
  if field_toggles:
175
181
  url += "&fieldToggles=%s" % urllib.parse.quote(
@@ -950,7 +950,7 @@ wheels = [
950
950
 
951
951
  [[package]]
952
952
  name = "twitter-cli"
953
- version = "0.4.0"
953
+ version = "0.4.1"
954
954
  source = { editable = "." }
955
955
  dependencies = [
956
956
  { name = "beautifulsoup4" },
File without changes
File without changes
File without changes
File without changes
File without changes