this post was submitted on 03 Jul 2023
4 points (100.0% liked)

Python

6134 readers
13 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

πŸ“… Events

October 2023

November 2023

PastJuly 2023

August 2023

September 2023

🐍 Python project:
πŸ’“ Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 1 year ago
MODERATORS
 

After seeing the work someone else did with migrating your subscriptions across accounts. I took their code and expanded upon it to fully synchronize your Lemmy instance accounts.

Feel free to give it a try. It's been useful for me to have accounts in multiple instances with the instability problems right now from the big influx of users.

Let me know what you think. Hopefully it can help a few people.

top 10 comments
sorted by: hot top controversial new old
[–] gkd@lemmy.ml 3 points 1 year ago

Hey if you’re interested in offering this as a web app of sorts reach out to me. I’m glad to provide hosting if you want. I’d also be interested in integrating with the app we are working on Memmy.

[–] MuskyRat@lemm.ee 2 points 1 year ago (1 children)

Just curious, will this script work if you have 2FA enabled on your Lemmy accounts?

[–] Ac5000@lemm.ee 3 points 1 year ago (1 children)

Sorry for the delay in getting back.

Currently it will not work with 2FA enabled. However, looking at the login post requirements I just need to add that as an option to put in the config.

I'll reply to this comment again when I get something put together. I'll add it to the GitHub issues list for tracking as well.

However, could you recommend an instance that uses 2FA for login so I can make an account to test it? I see the field in my current instances but would like something fresh to try it on.

[–] MuskyRat@lemm.ee 2 points 1 year ago

Thanks for the reply! I have accounts on lemm.ee and lemmy.world that use 2FA. Also have one with lemmy.sdf.org, but that one requires account creation approval.

[–] Gamera8ID@lemm.ee 1 points 1 year ago (1 children)

I'm getting a TypeError: unsupported operand type(s) for |: 'type' and 'NoneType' when I do:

git clone https://github.com/Ac5000/lemmy_account_sync.git
cd lemmy_account_sync/
pip install -r requirements.txt
cp exampleconfig.ini src/myconfig.ini
nano src/myconfig.ini
python3 src/lemmy_sync.py

I've confirmed that my [Main Account] and [Account 2] details are correct in myconfig.ini, but beyond that I don't really know what I'm doing.

[–] nanders@mander.xyz 0 points 1 year ago (1 children)

undefined> TypeError: unsupported operand type(s) for |

the | syntax to indicate multiple types was introduced in Python 3.10. It looks like you are using a an older Python version.

[–] Gamera8ID@lemm.ee 1 points 1 year ago* (last edited 1 year ago) (1 children)

That was it exactly. Thank you.

This was a journey, so I'm documenting it here for anyone who might run into a similar situation.

I'm using a Chromebook with Linux enabled.

To confirm my version of Python I ran python --version:

Python 3.9.2

OK! Getting somewhere. So I have to check what distribution of Linux is installed with grep '^PRETTY_NAME' /etc/os-release

PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"

Alright. Google says if I want to upgrade Python on Debian 11 I have to compile it from source. Yikes! But, wait, there's a PPA - Yay! But the PPA is for Ubuntu - Boo.

There isn't an active community for ChromeOS on Lemmy yet, but that other website has directions for replacing Debian with Ubuntu.

I'm lazy so I'm not doing that. I'm just going to spin up a temporary Ubuntu container that I can delete later, so my directions are much simpler:

Ctr-Alt-T to enter crosh, the ChromeOS developer shell.

vmc start termina
lxc launch ubuntu:22.04 ubuntu
lxc exec ubuntu -- bash
apt update && apt -y upgrade
add-apt-repository ppa:deadsnakes/ppa
apt update
apt install -y python3.11 python3.11-venv
python3.11 -m ensurepip
git clone https://github.com/Ac5000/lemmy_account_sync.git
cd lemmy_account_sync/
pip3.11 install -r requirements.txt
cp exampleconfig.ini src/myconfig.ini
nano src/myconfig.ini
python3.11 src/lemmy_sync.py

Success! I had to escape some special characters in my passwords, but that's easily Google-able.

I'll be keeping the container around for a little while to do some periodic syncs. Then I'll remove it using crosh.

vmc start termina
lxc delete ubuntu --force
[–] jnovinger@programming.dev 1 points 1 year ago* (last edited 1 year ago)

I've only used pyenv on Ubuntu machines, but I expect it would work just as well in Debian-based systems.

pyenv is really useful if you need multiple versions installed simultaneously and it handles installation for you.

https://github.com/pyenv/pyenv

[–] yoichi@lemm.ee 1 points 1 year ago* (last edited 1 year ago)

Worked perfectly. Thanks for making this, I really appreciate it. I was suprised that it was able to accept my password which included dollar signs. I assumed I should enclose it in double quotes, but I didn't need to

[–] Lzwzli@reddthat.com 1 points 1 year ago

Why is this needed?

load more comments
view more: next β€Ί