Add session file

This commit is contained in:
Neil 2023-05-28 19:36:48 -04:00
parent be6aaa9c2e
commit 8e6728af77
5 changed files with 8 additions and 3 deletions

View File

@ -1,4 +1,4 @@
FROM python:3.9
FROM python:3.11
COPY . /app

View File

@ -4,7 +4,7 @@ charset-normalizer==2.1.0
colorama==0.4.5
decorator==5.1.1
idna==3.3
instaloader==4.9.3
instaloader==4.9.6
Mastodon.py==1.5.1
python-dateutil==2.8.2
python-magic==0.4.27

0
src/arguments.py Normal file → Executable file
View File

View File

@ -40,10 +40,13 @@ agree = [1, True, "true", "True", "yes", "Yes"]
if (os.environ.get("USE_KUBERNETES")):
id_filename = "/data/already_posted.txt"
id_session = "/data/session"
elif (os.environ.get("USE_DOCKER")):
id_filename = "/app/already_posted.txt"
id_session = "/app/session"
else:
id_filename = "./already_posted.txt"
id_session = "./session"
print(id_filename)

View File

@ -14,10 +14,12 @@ def get_instagram_user(user, fetched_user):
print(Fore.GREEN + 'TEST 🚀 > Connecting to Instagram...')
print(Style.RESET_ALL)
print(datetime.datetime.now())
if os.path.exists(id_session):
L.load_session_from_file(user["name"], id_session)
if user["name"] != None:
print("USER USER USER!!!!!!!!!!!!!", user["name"])
L.login(user["name"], user["password"])
L.save_session_to_file(id_session)
return Profile.from_username(L.context, fetched_user)
def get_image(url):