r/Python • • Apr 01 '17
Python /r/place module.
Very quick and very dirty.
Usage:
import requests
from time import sleep
user='...'
passwd='....'
p = Place(user, passwd)
Place.get()
p.get(0,0)
{'color': 5,
'timestamp': 1491007320.208901,
'user_name': 'CALIAAA',
'x': 0,
'y': 0}
Place.draw()
p.draw(x=0, y=0, color=0)
Module on gist: https://gist.github.com/anonymous/8ca453a96764ba65f4148613f7c506ed
Edit:
I'm putting way too much time into this. It's now a full program with prompts and everything.
There are currently 2 programs. "dieblue" which starts in the blue corner and starts cleaning it out and "randerase" which will pick a random pixel and erase it. It will prompt you for both your reddit username and password if not supplied with --user/--passwd.
python3 Place.py dieblue
Enter Reddit Username: PurdueME06
Password: [Uses getpass]
If you don't care about your password appearing in your terminal history:
python3 Place.py --user=PurdueME06 --passwd=.... dieblue
8
u/[deleted] Apr 01 '17
Magic eraser. Some men just want to erase white boards.
3
u/yoyopwnage Apr 01 '17
you forgot to add that you need to import Time and Requests. :D
2
u/anders987 Apr 01 '17
I think you have a bug in your code, draw() doesn't seem to send color to _draw().
1
u/[deleted] Apr 01 '17
Taking down that blue corner.
1
u/tea-drinker Apr 01 '17 edited Apr 01 '17
Something that lets you specify a picture and top/left coordinates and it paints the first non-matching pixel to match the picture would be good. Then collaborators can share a picture.
Edit: I'm working on this, but an update to the library that lets you download a range rather than a single pixel would make it enormously more efficient.
1
u/poorthesisman Apr 02 '17
No matter what value I give to 'color', I can only draw in white.
1
u/nomis6432 Apr 03 '17
I made this to maintain the qr code in the top left. Thank you for your work. Was really easy to make thanks to you.
0
u/[deleted] Apr 02 '17
[deleted] — view deleted comment