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.
Python
Welcome to the Python community on the programming.dev Lemmy instance!
π Events
Past
November 2023
- PyCon Ireland 2023, 11-12th
- PyData Tel Aviv 2023 14th
October 2023
- PyConES Canarias 2023, 6-8th
- DjangoCon US 2023, 16-20th (!django π¬)
July 2023
- PyDelhi Meetup, 2nd
- PyCon Israel, 4-5th
- DFW Pythoneers, 6th
- Django Girls Abraka, 6-7th
- SciPy 2023 10-16th, Austin
- IndyPy, 11th
- Leipzig Python User Group, 11th
- Austin Python, 12th
- EuroPython 2023, 17-23rd
- Austin Python: Evening of Coding, 18th
- PyHEP.dev 2023 - "Python in HEP" Developer's Workshop, 25th
August 2023
- PyLadies Dublin, 15th
- EuroSciPy 2023, 14-18th
September 2023
- PyData Amsterdam, 14-16th
- PyCon UK, 22nd - 25th
π Python project:
- Python
- Documentation
- News & Blog
- Python Planet blog aggregator
π Python Community:
- #python IRC for general questions
- #python-dev IRC for CPython developers
- PySlackers Slack channel
- Python Discord server
- Python Weekly newsletters
- Mailing lists
- Forum
β¨ Python Ecosystem:
π Fediverse
Communities
- #python on Mastodon
- c/django on programming.dev
- c/pythorhead on lemmy.dbzer0.com
Projects
- PythΓΆrhead: a Python library for interacting with Lemmy
- Plemmy: a Python package for accessing the Lemmy API
- pylemmy pylemmy enables simple access to Lemmy's API with Python
- mastodon.py, a Python wrapper for the Mastodon API
Feeds
If only I had found this yesterday when I did everything by hand. Great to see this nevertheless!
Came here to say this! But still - thank you! I have a feeling it will be invaluable, at least in the short term.
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
Why is this needed?
There's not currently a way to copy your subscriptions across from one instance to another, so if you want to instance hop, you have to go resubscribe to all your communities manually.
Also if you have redundant accounts for when an instance is having trouble (I had errors reaching programming.dev just last night), it seems like you can run this periodically and keep them in sync with each other
Correct. lemmy.world was my original account. But with the server strain going on, I've hopped over to lemm.ee and also have a couple other accounts. Just run this script every so often and all your accounts will more or less feel like the same account.
Thanks for this! I haven't been able to get it to work yet but it seems to be because the instances I use are dealing with issues.
Edit: Finally managed to get the script to complete. My advice for anyone trying this is if you run into a 502 error it's most likely that the instance is getting hammered and that you should try again later
Yeah, for anyone that gets the 502 gateway error. That means the instance was down when it tried to login/didn't respond. I'm going to revisit this part of the code later and see if I can fix/handle that happening so it at least goes through with the rest of the accounts. If it happens to you, just run it again and hopefully you'll get through at least once.
Subsequent runs actually hit the servers with less requests since you can pull most of the info you need with the initial site response and I check that before making any needed requests.
Also, someone else mentioned they had a problem with the none type thing. I'm using Python 3.11 and forgot to specify that. I'll add it to the readme when I get a chance.
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.
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.
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
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.
You could even have tried with the python3:latest container :)
TIL!
Just curious, will this script work if you have 2FA enabled on your Lemmy accounts?
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.
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.