Skip to content

Commit

Permalink
Add utils package to organize app utils
Browse files Browse the repository at this point in the history
  • Loading branch information
iSarabjitDhiman committed Sep 27, 2024
1 parent 1c6c701 commit 73e4b08
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 21 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup, find_packages

VERSION = "2.0.2"
VERSION = "2.0.3"
SHORT_DESCRIPTION = "TweeterPy is a python library to extract data from Twitter. TweeterPy API lets you scrape data from a user's profile like username, userid, bio, followers/followings list, profile media, tweets, etc."

with open("requirements.txt") as file:
Expand Down
2 changes: 1 addition & 1 deletion tweeterpy/api_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import tempfile
import demjson3
import logging.config
from tweeterpy.request_util import RequestClient
from tweeterpy.utils.request import RequestClient
from tweeterpy.constants import Path, FeatureSwitch, API_TMP_FILE, LOGGING_CONFIG

logging.config.dictConfig(LOGGING_CONFIG)
Expand Down
2 changes: 1 addition & 1 deletion tweeterpy/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
'custom': {
# 'format': '%(asctime)s [%(levelname)s] %(name)s: %(message)s'
'class': 'tweeterpy.logging_util.CustomFormatter',
'class': 'tweeterpy.utils.logging.CustomFormatter',
}
},
'handlers': {
Expand Down
17 changes: 2 additions & 15 deletions tweeterpy/login_util.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import random
from tweeterpy.constants import Path
from tweeterpy.util import find_nested_key
from tweeterpy.request_util import RequestClient
from tweeterpy.logging_util import disable_logger
from tweeterpy.utils.request import RequestClient
from tweeterpy.utils.logging import disable_logger


class TaskHandler:
Expand Down Expand Up @@ -90,19 +90,6 @@ def _handle_suspicious_login(self, flow_token, subtask_id="LoginAcid",verificati

@disable_logger
def login(self, username, password, email=None, phone=None, **kwargs):
# MANUAL WAY OF HANDLING LOG IN
"""
initital_flow_token = self._get_flow_token()
self._get_javscript_instrumentation_subtask()
user_flow_token = self._get_user_flow_token(initital_flow_token)
password_flow_token = self._get_password_flow_token(
user_flow_token, username=username)
account_duplication_flow_token = self._get_account_duplication_flow_token(
password_flow_token, password=password)
return self._check_account_duplication(account_duplication_flow_token)
"""

# DYNAMIC WAY OF HANDLING LOG IN - BETTER
response = None
error_message = None
tasks_pending = True
Expand Down
6 changes: 3 additions & 3 deletions tweeterpy/tweeterpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
from tweeterpy.api_util import ApiUpdater
from tweeterpy.tid import ClientTransaction
from tweeterpy.login_util import TaskHandler
from tweeterpy.request_util import RequestClient
from tweeterpy.logging_util import set_log_level
from tweeterpy.session_util import load_session, save_session
from tweeterpy.utils.request import RequestClient
from tweeterpy.utils.logging import set_log_level
from tweeterpy.utils.session import load_session, save_session
from tweeterpy.constants import Path, FeatureSwitch, LOGGING_CONFIG

logging.config.dictConfig(LOGGING_CONFIG)
Expand Down
Empty file added tweeterpy/utils/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 73e4b08

Please sign in to comment.