tweepy-self 1.0.0b2__py3-none-any.whl → 1.0.1__py3-none-any.whl

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.
@@ -1,13 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tweepy-self
3
- Version: 1.0.0b2
3
+ Version: 1.0.1
4
4
  Summary: Twitter (selfbot) for Python!
5
5
  Author: Alen
6
6
  Author-email: alen.kimov@gmail.com
7
- Requires-Python: >=3.9,<4.0
7
+ Requires-Python: >=3.11,<4.0
8
8
  Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3.9
10
- Classifier: Programming Language :: Python :: 3.10
11
9
  Classifier: Programming Language :: Python :: 3.11
12
10
  Classifier: Programming Language :: Python :: 3.12
13
11
  Requires-Dist: beautifulsoup4 (>=4,<5)
@@ -50,7 +48,7 @@ pip install tweepy-self
50
48
  import asyncio
51
49
  import twitter
52
50
 
53
- account = twitter.Account("auth_token")
51
+ account = twitter.Account(auth_token="auth_token")
54
52
 
55
53
  async def main():
56
54
  async with twitter.Client(account) as twitter_client:
@@ -1,16 +1,15 @@
1
- twitter/__init__.py,sha256=ydA6wuWhW7-0sYmaJyl5_7wIaekKdaBaN7aO6elywLk,465
2
- twitter/account.py,sha256=vXPd3ag3lmYbSblAnHJLm6t42SyFNbULpjWkRPiDhT0,1787
1
+ twitter/__init__.py,sha256=hdrsdbH_qFhx6ro1ct79qF9SpkgFhxgbYUw9A4RVuec,684
2
+ twitter/account.py,sha256=Vb9MCRxIQRODnefchXg3m0BGzQ1mEJnaL3xbv29zGTw,3294
3
3
  twitter/base/__init__.py,sha256=x0EHKv4q_FI6xEq2nL4V9s8P6VWr6IaHTqdH9sXB5d8,133
4
4
  twitter/base/client.py,sha256=7byb0Psai-dvg_ww6Y7uyE2hV1pfTU653hFgVdRiqXo,478
5
5
  twitter/base/session.py,sha256=6-gLhdSCaTCd_zv3YgUtVRGbfiAawXuDRBoo7s5bGSs,2234
6
6
  twitter/client.py,sha256=v2ebGB3NxmEmStePAddNR5XX7oqBCn0Fm86wf0l7MVI,53004
7
7
  twitter/errors.py,sha256=U6kGyNp_5tEq-RwxLjm61muJLEp5BYBq9vrPBkCxr_g,4088
8
8
  twitter/models.py,sha256=3-Lft160msCqOjRPubOmxMqWUkmjlTSzHSGsvZK91nU,1817
9
- twitter/utils/__init__.py,sha256=2sjQEu5jJgUEpGYT_arwNVhaboywCbYLB00eiD0mZCk,743
10
- twitter/utils/accounts.py,sha256=lp7c4GyScAsY65V52V5Buquj8OZgWFyi-54YloRpOfE,1556
9
+ twitter/utils/__init__.py,sha256=pyhQXwTdp0HFwV_UNF4dTyklLD9RtaefA16SrQXeNlg,589
11
10
  twitter/utils/file.py,sha256=-6n8I8KWDlntfciJJsfIeOi0gmqoHRIe1ldIx1ynGUE,1118
12
11
  twitter/utils/html.py,sha256=Cs55MxVyZLSKiCEj11ALUrnCW9ADZ4CEDCE0gKESzO0,1627
13
12
  twitter/utils/other.py,sha256=4NaGd2CIJVrDiW17shcrDlJRqFkQNbBSTiiH7kNWcww,559
14
- tweepy_self-1.0.0b2.dist-info/METADATA,sha256=0rOKLx8U1hRVeRKk9T6qnRHu_RAP3sqbOFV5qSajmKA,9230
15
- tweepy_self-1.0.0b2.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
16
- tweepy_self-1.0.0b2.dist-info/RECORD,,
13
+ tweepy_self-1.0.1.dist-info/METADATA,sha256=VZSfr-iUZQ11lIY9jpgPeJmmN2dzUXSqHugLAWRTy_4,9139
14
+ tweepy_self-1.0.1.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
15
+ tweepy_self-1.0.1.dist-info/RECORD,,
twitter/__init__.py CHANGED
@@ -6,7 +6,7 @@ A basic wrapper for the Twitter user API.
6
6
  """
7
7
 
8
8
  from .client import Client
9
- from .account import Account, AccountStatus
9
+ from .account import Account, AccountStatus, load_accounts_from_file, extract_accounts_to_file
10
10
  from .models import Tweet, UserData
11
11
  from . import errors, utils
12
12
 
@@ -16,9 +16,15 @@ __all__ = [
16
16
  "AccountStatus",
17
17
  "utils",
18
18
  "errors",
19
+ "load_accounts_from_file",
20
+ "extract_accounts_to_file",
19
21
  ]
20
22
 
21
23
 
22
24
  import warnings
23
25
  # HACK: Ignore event loop warnings from curl_cffi
24
26
  warnings.filterwarnings('ignore', module='curl_cffi')
27
+
28
+
29
+ from python3_capsolver.core import config
30
+ config.APP_ID = "6F895B2F-F454-44D1-8FE0-77ACAD3DBDC8"
twitter/account.py CHANGED
@@ -1,9 +1,11 @@
1
+ from pathlib import Path
2
+ from typing import Sequence, Iterable
1
3
  import enum
2
4
 
3
5
  from pydantic import BaseModel, Field
4
6
  import pyotp
5
7
 
6
- from .utils import hidden_value
8
+ from .utils import hidden_value, load_lines, write_lines
7
9
 
8
10
 
9
11
  class AccountStatus(enum.StrEnum):
@@ -56,3 +58,41 @@ class Account(BaseModel):
56
58
  raise ValueError("No key2fa")
57
59
 
58
60
  return str(pyotp.TOTP(self.key2fa).now())
61
+
62
+
63
+ def load_accounts_from_file(
64
+ filepath: Path | str,
65
+ *,
66
+ separator: str = ":",
67
+ fields: Sequence[str] = ("auth_token", "password", "email", "username"),
68
+ ) -> list[Account]:
69
+ """
70
+ :param filepath: Путь до файла с данными об аккаунтах.
71
+ :param separator: Разделитель между данными в строке.
72
+ :param fields: Кортеж, содержащий имена полей в порядке их появления в строке.
73
+ :return: Список Twitter аккаунтов.
74
+ """
75
+ accounts = []
76
+ for line in load_lines(filepath):
77
+ data = dict(zip(fields, line.split(separator)))
78
+ data.update({key: None for key in data if not data[key]})
79
+ accounts.append(Account(**data))
80
+ return accounts
81
+
82
+
83
+ def extract_accounts_to_file(
84
+ filepath: Path | str,
85
+ accounts: Iterable[Account],
86
+ *,
87
+ separator: str = ":",
88
+ fields: Sequence[str] = ("auth_token", "password", "email", "username"),
89
+ ):
90
+ lines = []
91
+ for account in accounts:
92
+ account_data = []
93
+ for field_name in fields:
94
+ field = getattr(account, field_name)
95
+ field = field if field is not None else ""
96
+ account_data.append(field)
97
+ lines.append(separator.join(account_data))
98
+ write_lines(filepath, lines)
twitter/utils/__init__.py CHANGED
@@ -7,10 +7,6 @@ from .file import (
7
7
  write_json,
8
8
  to_json,
9
9
  )
10
- from .accounts import (
11
- load_accounts_from_file,
12
- extract_accounts_to_file,
13
- )
14
10
  from .html import (
15
11
  parse_unlock_html,
16
12
  parse_oauth_html,
@@ -31,8 +27,6 @@ __all__ = [
31
27
  "write_lines",
32
28
  "write_json",
33
29
  "to_json",
34
- "load_accounts_from_file",
35
- "extract_accounts_to_file",
36
30
  "parse_unlock_html",
37
31
  "parse_oauth_html",
38
32
  "remove_at_sign",
twitter/utils/accounts.py DELETED
@@ -1,43 +0,0 @@
1
- from pathlib import Path
2
- from typing import Sequence, Iterable
3
-
4
- from .file import load_lines, write_lines
5
- from ..account import Account
6
-
7
-
8
- def load_accounts_from_file(
9
- filepath: Path | str,
10
- *,
11
- separator: str = ":",
12
- fields: Sequence[str] = ("auth_token", "password", "email", "username"),
13
- ) -> list[Account]:
14
- """
15
- :param filepath: Путь до файла с данными об аккаунтах.
16
- :param separator: Разделитель между данными в строке.
17
- :param fields: Кортеж, содержащий имена полей в порядке их появления в строке.
18
- :return: Список Twitter аккаунтов.
19
- """
20
- accounts = []
21
- for line in load_lines(filepath):
22
- data = dict(zip(fields, line.split(separator)))
23
- data.update({key: None for key in data if not data[key]})
24
- accounts.append(Account(**data))
25
- return accounts
26
-
27
-
28
- def extract_accounts_to_file(
29
- filepath: Path | str,
30
- accounts: Iterable[Account],
31
- *,
32
- separator: str = ":",
33
- fields: Sequence[str] = ("auth_token", "password", "email", "username"),
34
- ):
35
- lines = []
36
- for account in accounts:
37
- account_data = []
38
- for field_name in fields:
39
- field = getattr(account, field_name)
40
- field = field if field is not None else ""
41
- account_data.append(field)
42
- lines.append(separator.join(account_data))
43
- write_lines(filepath, lines)