Giter VIP home page Giter VIP logo

reddit-place-script-2022's Introduction

Reddit Place Script 2022

Code style: black forthebadge forthebadge

Thanks to everyone who contributed! r/place is now over!

About

This is a script to draw an image onto r/place (https://www.reddit.com/r/place/).

Features

  • Support for multiple accounts.
  • Determines the cooldown time remaining for each account.
  • Detects existing matching pixels on the r/place map and skips them.
  • Automatically converts colors to the r/place color palette.
  • Easy(ish) to read output with colors.
  • SOCKS proxy support.
  • No client id and secret needed.
  • Proxies from "proxies.txt" file.
  • Tor support.

Requirements

macOS

If you want to use tor on macOS. you'll need to provide your own tor binary or install it via Homebrew using brew install tor, and start it manually.

Make sure to deactivate the "use_builtin tor" option in the config and configure your tor to use the correct ports and password.

Please note that socks proxy connection to tor doesn't work for the time being, so the config value is for an httpTunnel port

Get Started

Move the file 'config_example.json' to 'config.json'

Edit the values to replace with actual credentials and values

Note: Please use https://jsonlint.com/ to check that your JSON file is correctly formatted

{
	//Where the image's path is
	"image_path": "image.png",
	// [x,y] where you want the top left pixel of the local image to be drawn on canvas
	"image_start_coords": [741, 610],
	// delay between starting threads (can be 0)
	"thread_delay": 2,
	// array of accounts to use
	"workers": {
		// username of account 1
		"worker1username": {
			// password of account 1
			"password": "password",
			// which pixel of the image to draw first
			"start_coords": [0, 0]
		},
		// username of account 2
		"worker1username": {
			// password of account 2
			"password": "password",
			// which pixel of the image to draw first
			"start_coords": [0, 0]
		}
		// etc... add as many accounts as you want (but reddit may detect you the more you add)
	}
}

Notes

  • Use .png if you wish to make use of transparency or non rectangular images
  • If you use 2 factor authentication (2FA) in your account, then change password to password:XXXXXX where XXXXXX is your 2FA code.

Run the Script

Windows

start.bat or startverbose.bat

Unix-like (Linux, macOS etc.)

chmod +x start.sh startverbose.sh
./start.sh or ./startverbose.sh

You can get more logs (DEBUG) by running the script with -d flag:

python3 main.py -d or python3 main.py --debug

Multiple Workers

Just create multiple child arrays to "workers" in the .json file:

{
	"image_path": "image.png",
	"image_start_coords": [741, 610],
	"thread_delay": 2,

	"workers": {
		"worker1username": {
			"password": "password",
			"start_coords": [0, 0]
		},
		"worker2username": {
			"password": "password",
			"start_coords": [0, 50]
		}
	}
}

In this case, the first worker will start drawing from (0, 0) and the second worker will start drawing from (0, 50) from the input image.jpg file.

This is useful if you want different threads drawing different parts of the image with different accounts.

Other Settings

If any JSON decoders errors are found, the config.json needs to be fixed. Make sure to add the below 2 lines in the file.

{
	"thread_delay": 2,
	"unverified_place_frequency": false,
	"proxies": ["1.1.1.1:8080", "2.2.2.2:1234"],
	"compact_logging": true
}
  • thread_delay - Adds a delay between starting a new thread. Can be used to avoid ratelimiting.
  • unverified_place_frequency - Sets the pixel place frequency to the unverified account limit.
  • proxies - Sets proxies to use for sending requests to reddit. The proxy used is randomly selected for each request. Can be used to avoid ratelimiting.
  • compact_logging - Disables timer text until next pixel.
  • Transparency can be achieved by using the RGB value (69, 42, 0) in any part of your image.
  • If you'd like, you can enable Verbose Mode by adding --verbose to "python main.py". This will output a lot more information, and not neccessarily in the right order, but it is useful for development and debugging.
  • You can also setup proxies by creating a "proxies" and have a new line for each proxies.

Tor

Tor can be used as an alternative to normal proxies. Note that currently, you cannot use normal proxies and tor at the same time.

"using_tor": false,
"tor_ip": "127.0.0.1",
"tor_port": 1881,
"tor_control_port": 9051,
"tor_password": "Passwort",
"tor_delay": 5,
"use_builtin_tor": true

The config values are as follows:

  • Deactivates or activates tor.
  • Sets the ip/hostname of the tor proxy to use
  • Sets the httptunnel port that should be used.
  • Sets the tor control port.
  • Sets the password (leave it as "Passwort" if you want to use the default binaries.
  • The delay that tor should receive to process a new connection.
  • Whether the included tor binary should be used. It is preconfigured. If you want to use your own binary, make sure you configure it properly.

Note that when using the included binaries, only the tunnel port is explicitly set while starting tor.

If you want to use your own binaries, follow these steps:

  • Get tor standalone for your platform here. For Windows just use the expert bundle. For macOS, you can use Homebrew to install tor: brew install tor.
  • In your tor folder, create a file named torrc. Copy this into it.
  • Search for ControlPort in your torrc file and uncomment it. Change the port number to your desired control port.
  • Decide on the password you want to use. Run tor --hash-password PASSWORD from a terminal in the folder with your tor executable, with "PASSWORD" being your desired password. Copy the resulting hash.
  • Search for HashedControlPassword and uncomment it. Paste the hash value you copied after it.
  • Decide on a port for your httptunnel. The default for this script is 1881.
  • Fill in your password, your httptunnel port and your control port in this script's config.json and enable tor with using_tor = true.
  • To start tor, run tor --defaults-torrc PATHTOTORRC --HttpTunnelPort TUNNELPORT, with PATHTOTORRC being your path to the torrc file you created and TUNNELPORT being your httptunnel port.
  • Now run the script and (hopefully) everything should work.

License for the included tor binary:

Tor is distributed under the "3-clause BSD" license, a commonly used software license that means Tor is both free software and open source: Copyright (c) 2001-2004, Roger Dingledine Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson Copyright (c) 2007-2019, The Tor Project, Inc. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the names of the copyright owners nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Docker

A dockerfile is provided. Instructions on installing docker are outside the scope of this guide.

To build: After editing the config.json file, run docker build . -t place-bot. and wait for the image to build.

You can now run it with docker run place-bot

Contributing

See the Contributing Guide.

reddit-place-script-2022's People

Contributors

antonio32a avatar bjb28 avatar deemfox avatar entropyvalley avatar funwithtriangles avatar glob-bruh avatar itsmohmans avatar ixi2101 avatar jacksors avatar jakonl avatar lukacholombardi avatar maltejur avatar marius851000 avatar michaelshumshum avatar nsk126 avatar ph-ill avatar popcornplant avatar pullgang avatar randomblock1 avatar randomgamer123 avatar rdeepak2002 avatar risewill23 avatar robiot avatar romainl972 avatar rsedxcftvgyhbujnkiqwe avatar russianfool avatar skyline-9 avatar thoroc avatar tyalie avatar zorudarinku avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

reddit-place-script-2022's Issues

Are you able to compile this into GUI?

No need to be fancy shit just option to load specific image what bots should draw and repair if i select that option. Will pay you 10$ :) Also i want support for multiple accounts and perhaps proxies so they don't get banned if they do IP detection. Or if they are not IP detected/shadowbanned then just compile without proxy support. But support for mutliple accounts. :)

KeyError: 'access_token'

This is the log I'm getting when I run main.py, what can I do to fix this?

available colors (rgb):  [(255, 69, 0), (255, 168, 0), (255, 214, 53), (0, 163, 104), (126, 237, 86), (36, 80, 164), (54, 144, 234), (81, 233, 244), (129, 30, 159), (180, 74, 192), (255, 153, 170), (156, 105, 38), (0, 0, 0), (137, 141, 144), (212, 215, 217), (255, 255, 255)]
image size:  (34, 21)
done drawing image locally to new_image.jpg
330 seconds until next pixel is drawn
refreshing access token...
received response:  {"error": "invalid_grant"}
Traceback (most recent call last):
  File "C:\Users\rishw\Downloads\place_frc\1\main.py", line 189, in <module>
    access_token = response_data["access_token"]
KeyError: 'access_token'

ValueError: too many values to unpack

Hi. I followed the colour palette in the script but whenever I try to run it the following error pops up.

Exception in thread Thread-4:
Traceback (most recent call last):
File "C:\Users\juliu\AppData\Local\Programs\Python\Python39\lib\threading.py", line 973, in _bootstrap_inner
self.run()
File "C:\Users\juliu\AppData\Local\Programs\Python\Python39\lib\threading.py", line 910, in run
self._target(*self._args, **self._kwargs)
File "D:\Tools\reddit-place-script-2022-main\main.py", line 492, in task
current_r, current_c, new_rgb = get_unset_pixel(
File "D:\Tools\reddit-place-script-2022-main\main.py", line 283, in get_unset_pixel
new_rgb = closest_color(target_rgb, rgb_colors_array)
File "D:\Tools\reddit-place-script-2022-main\main.py", line 111, in closest_color
r, g, b = target_rgb
ValueError: too many values to unpack (expected 3)

Any idea how to fix it?

Can I make a GUI out of this?

I would like to make a quick GUI with Godot that can fetch and display the current state of r/place and can draw on it. Can I use this as a sort of backend?

Could I get a bit of help?

I get this error when running:
C:\Users\HP\Desktop\reddit-place-script-2022-main>python3 main.py
image size: (27, 17)
-------Thread #0-------
Refreshing access token...
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\threading.py", line 926, in _bootstrap_inner
self.run()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "main.py", line 410, in task
access_tokens[credentials_index] = response_data["access_token"]
KeyError: 'access_token'

429 Error - Too many requests

When I run, I get the following error:

Thread #0
refreshing access token...
received response: {"message": "Too Many Requests", "error": 429}

Pixels placed diagonally

I believe there is a small bug where the drawing will come out diagonally.
At line 238 in main.py both x and y (c and r) are incremented regardless of whether the images max width or height is met.

I'm thinking perhaps it should be:

current_r += 1

# go back to first column when reached end of a row while drawing
if current_r >= image_width:
    current_r = 0
    current_c += 1

Has anyone still figured out the full bitmap fetches?

This static link still works, as it was posted by someone else.

Of course, simply checking in the network tab of any chromium-based browser will reveal where this came from. The only problem is that the images load in completely transparent for me. Is this the case for anyone else? If not, have we figured out how these links are formatted? I know the first bit is a UNIX timestamp, and the middle bit -0-f- is static across all of the full image URLs. My first thought was that the ending bit was some sort of hash function on the timestamp, but I wasn't able to find anything that quite matched up. I admittedly don't have the motivation to investigate much further, but I would hope that anyone with more information would share it around. After all, it was confirmed that r/place will be sticking around until April 4th.

Extreme rate limiting

Ran this script with a small set of accounts and started receiving responses with rate limit errors, claiming my next available time is some absurdly high number:

received response: {"errors":[{"message":"Ratelimited","path":["act"],"extensions":{"nextAvailablePixelTs":1648869782000}},{"message":"ratelimit hit, next available: 1648869782000","path":["act"]}],"data":null}

received response: {"data":{"act":{"data":[{"id":"...","data":{"nextAvailablePixelTimestamp":1.648871046e+12,"__typename":"GetUserCooldownResponseMessageData","__typename":"GetUserCooldownResponseMessageData"},"__typename":"BasicMessage","__typename":"BasicMessage"}, ...

And thus no pixels get placed, even if I restart the script. Seems like I've triggered an anti-botting measure. Does not seem necessarily related to IP as I am still able to place on another account on a different device.

An immediate thought that comes to mind might be staggering the threads by a few seconds so they aren't all hitting the API at the same exact moment.

[BUG] Not working with account using 2FA

Bug Report Form

Checklist

  • I am using the latest version of the code.
  • I am absolutely sure I read the README in its entirety.
  • I have made sure this is not a duplicate issue.
  • I have filled out this form correctly.

Describe the bug

This script is not working when account uses 2FA.

available colors for palette (rgb):  [(255, 69, 0), (255, 168, 0), (255, 214, 53), (0, 163, 104), (126, 237, 86), (36, 80, 164), (54, 144, 234), (81, 233, 244), (129, 30, 159), (180, 74, 192), (255, 153, 170), (156, 105, 38), (0, 0, 0), (137, 141, 144), (212, 215, 217), (255, 255, 255)]
image size:  (2, 2)
-------Thread #0-------
Refreshing access token...
received response:  {"error": "invalid_grant"}
Exception in thread Thread-1:
Traceback (most recent call last):
  File "F:\tools\anaconda3\envs\web_scraping\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "F:\tools\anaconda3\envs\web_scraping\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "main.py", line 461, in task
    access_tokens[credentials_index] = response_data["access_token"]
KeyError: 'access_token'

To Reproduce

Steps to trigger the bug:

  1. Execute the script

Line 461 in task access_tokens[credentials_index] = response_data["access_token"]

Hello, i am getting an error when starting the script on line 461.
Here's the error i am getting:

    ~/De/reddit-place-script-2022-main  python3 main.py                ✔ 
image size:  (7, 7)
-------Thread #0-------
Refreshing access token...
Exception in thread Thread-1 (task):
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
  File "/home/escaleira/Desktop/reddit-place-script-2022-main/main.py", line 461, in task
    access_tokens[credentials_index] = response_data["access_token"]
KeyError: 'access_token'

And here's my .env:

ENV_PLACE_USERNAME='["can'tshowthis"]'
ENV_PLACE_PASSWORD='["can'tshowthis"]'
ENV_PLACE_APP_CLIENT_ID='["hWGC-ki958LEDt7P_15EXg"]'
ENV_PLACE_SECRET_KEY='["t5CnJRUMGkA7FC3oXTChj7jUQa4WEw"]'
ENV_DRAW_X_START="856"
ENV_DRAW_Y_START="360"
ENV_R_START='["0"]'
ENV_C_START='["0"]'

Can someone help me with this? I am trying to protect the Portuguese flag.

Help needed

So basically I run the code and I get this error "ValueError: too many values to unpack (expected 3)" I've probably done something dumb but can anyone help?
Here is the full run module
image size: (3, 5)
-------Thread #0-------
Refreshing access token...
received new access token: 1680473457874-Y7BF7TnGgKDPVJpBs9MZm5Qe02uhIQ
Getting board
Got image: https://hot-potato.reddit.com/media/canvas-images/1648905786512-0-f-kzZio1q9.png
Exception in thread Thread-1 (task):
Traceback (most recent call last):
File "C:\Python310\lib\threading.py", line 1009, in _bootstrap_inner
self.run()
File "C:\Python310\lib\threading.py", line 946, in run
self._target(*self._args, **self._kwargs)
File "D:\reddit-place-script-2022-main\main.py", line 492, in task
current_r, current_c, new_rgb = get_unset_pixel(
File "D:\reddit-place-script-2022-main\main.py", line 283, in get_unset_pixel
new_rgb = closest_color(target_rgb, rgb_colors_array)
File "D:\reddit-place-script-2022-main\main.py", line 111, in closest_color
r, g, b = target_rgb
ValueError: too many values to unpack (expected 3)

multiple issues

Capture
Timer is 620 seconds instead of 330

image
Timing is even more messed up with multiple accounts

image
image
image
First pixel started at 538,236 instead of 537.236 as stated in .env and all the following pixels seem to be placed in random locations (don't know if it's a bug or if there is a logic behind it)

Verbose Mode Off Issue - Threads Reporting Writing to Same Pixel

Greetings team,

I have noticed when verbose is off I see all threads reporting they are writing to the same pixel.
Screen shot:
Screen Shot 2022-04-02 at 12 53 27 AM

When Verbose Mode is turned On the threads all report they are writing to different pixels:
Screen Shot 2022-04-02 at 12 55 37 AM

Unfortunately I am too tired to dig into this at the moment but will get back at it tomorrow. If one of you can figure this out I would greatly appreciate it!

Thanks
JAK

[BUG] Wasting moves by placing blue on top of blue

Bug Report Form

Checklist

  • I am using the latest version of the code.
  • I am absolutely sure I read the README in its entirety.
  • I have made sure this is not a duplicate issue.
  • I have filled out this form correctly.

Describe the bug

I have 6 accounts working on a small area (5x4). Often there is no need for them to make a move because the image is complete, but they still do, by placing the same color on top of itself.

keep getting "Expecting value: line 1 column 2 (char 1)"

anytime I run main.py, it comes back with this
Traceback (most recent call last): File "D:\download\reddit-place-script-2022-1.0.0\reddit-place-script-2022-1.0.0\main.py", line 269, in <module> num_credentials = len(json.loads(os.getenv('ENV_PLACE_USERNAME'))) File "C:\Program Files\Python310\lib\json\__init__.py", line 346, in loads return _default_decoder.decode(s) File "C:\Program Files\Python310\lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "C:\Program Files\Python310\lib\json\decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 2 (char 1)

My .env file is set up, don't really know why this is happening. I tried reinstall python, setting up the path for dotenv. have no clue why this is happening.

Support for easier configuration

Now passing values is very difficult and messy. It would be way easier to have a config.json with values like this

{
    "image_start_coords": [741, 610],

    "workers": {
        "robiot": {
            "password": "test",
            "client_id": "test",
            "client_secret": "test",
            "start_coords": [0, 2]
        },
        "weirdaccount": {
            "password": "test",
            "client_id": "test",
            "client_secret": "test",
            "start_coords": [0, 2]
        }
    }
}

3 accounts

where should I write the third coordinate?

Less dumb method of setting pixels

You should check out my fork, it's an older version of your script, but it has a way to check the pixels on the board.
so that you could implement that in the new version

Logs

Would it be possible for the log to say which pixel it just changed in (x,y) format?

Also does the script automatically look for the next changeable tile if the one it starts with is already the right color? And how does the R_START and C_START work? is the 0,0 top left or center and when using multiple accounts, how can you configure so that you get maximum coverage?

why .jpg?

why not use .png? so we can use transparency so we can ignore transparent pixels?

How to set arrays

Edit: Ok I had a stroke I get it now
Going to set several accounts, but I don't know which array format to use. Thoughts?

Found why multithreading isn't working

It seems like only one thread runs the first time because firstrun immediately gets set to False. It should probably be a counter that only applies the wait when it's greater than the # of threads. Or something like that.

Alternatively, you could just move the waiting logic after you send a request. It should send a request and then loop itself into waiting.

Bot placing pixels out of range of image

I'm not quite sure why, but for some reason my bot accounts are only placing pixels on the coordinate one below what should be the bottom left corner of the image. I've double checked my image resolution and coordinate placements, but everything appears to be fine in terms of config. I'm looking into the issue, but figured I'd make others aware.

Too many values to unpack

There's an (r, g, b, a) value attempting to be unpacked into r, g, b. Error is in line on of closest_color. I have the same exact package versions as the requirements.txt for stuff so I'm not sure what's up here

Discord

Hey there,
Me and a few other Reddit users are working on a project like this, and we'd like to add you to our group chat.
Please contact me at AstroOrbis#9797.
Thanks!

Certificate Verify Failed

When I try running main.py I get a "SSLCertVerificationError":

Exception in thread Thread-1 (task): Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 1009, in _bootstrap_inner self.run() File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 946, in run self._target(*self._args, **self._kwargs) File "/Users/edwarddiller/reddit-place-script-2022-main/main.py", line 493, in task get_board(access_tokens[credentials_index]), File "/Users/edwarddiller/reddit-place-script-2022-main/main.py", line 186, in get_board ws = create_connection( File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/websocket/_core.py", line 601, in create_connection websock.connect(url, **options) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/websocket/_core.py", line 244, in connect self.sock, addrs = connect(url, self.sock_opt, proxy_info(**options), File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/websocket/_http.py", line 136, in connect sock = _ssl_socket(sock, options.sslopt, hostname) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/websocket/_http.py", line 272, in _ssl_socket sock = _wrap_sni_socket(sock, sslopt, hostname, check_hostname) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/websocket/_http.py", line 248, in _wrap_sni_socket return context.wrap_socket( File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 512, in wrap_socket return self.sslsocket_class._create( File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1070, in _create self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1341, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)

[question] just a question on why it is not working for me really sorry

Hi,

I am getting the following error when trying to run the script can someone please help me?

Exception in thread Thread-1 (task):
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
self.run()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 946, in run
self._target(*self._args, **self._kwargs)
File "/Users/admin/Downloads/reddit-place-script-2022-main/main.py", line 493, in task
get_board(access_tokens[credentials_index]),
File "/Users/admin/Downloads/reddit-place-script-2022-main/main.py", line 186, in get_board
ws = create_connection(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/websocket/_core.py", line 601, in create_connection
websock.connect(url, **options)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/websocket/_core.py", line 244, in connect
self.sock, addrs = connect(url, self.sock_opt, proxy_info(**options),
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/websocket/_http.py", line 136, in connect
sock = _ssl_socket(sock, options.sslopt, hostname)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/websocket/_http.py", line 272, in _ssl_socket
sock = _wrap_sni_socket(sock, sslopt, hostname, check_hostname)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/websocket/_http.py", line 248, in _wrap_sni_socket
return context.wrap_socket(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 512, in wrap_socket
return self.sslsocket_class._create(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1070, in _create
self.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1341, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)

I am using macOS fyi. Why is my ssl certificate verification failing?

multiple threads don't seem to work

Either something wrong with my second account or Reddit is blocking based on IP?

__________________
Thread #1
Error refreshing tokens or drawing pixel
Trying again in 5 minutes...
__________________
received response:  {"access_token": "2133296599-IQ6KguD3j7u-aZhWlUjhgb8VUg", "token_type": "bearer", "expires_in": 3600, "scope": "*"}
received new access token:  2133296599-IQ6KguD3j7u-aZhWlUjhgb8VUg
__________________

Not a bug or anything. I just don't know why this isn't working for me...sorry to bother..

Help?

PS C:\Users\PC\Documents\GitHub\reddit-place-script-2022> & C:/Users/PC/AppData/Local/Programs/Python/Python310/python.exe c:/Users/PC/Documents/GitHub/reddit-place-script-2022/main.py image size: (13, 14) Traceback (most recent call last): File "c:\Users\PC\Documents\GitHub\reddit-place-script-2022\main.py", line 494, in <module> num_credentials = len(json.loads(os.getenv("ENV_PLACE_USERNAME"))) File "C:\Users\PC\AppData\Local\Programs\Python\Python310\lib\json\__init__.py", line 339, in loads raise TypeError(f'the JSON object must be str, bytes or bytearray, ' TypeError: the JSON object must be str, bytes or bytearray, not NoneType

Exception error

The script was working well before i updated it to the new fork, now im getting an error.

Getting board
Got image: https://hot-potato.reddit.com/media/canvas-images/1648879576430-0-f-jKSA6UA5.png
22 644
1 0 boardimg 48 35
Exception in thread Thread-1 (task):
Traceback (most recent call last):
  File "C:\Python310\lib\threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "C:\Python310\lib\threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\ilank\OneDrive\Desktop\pythonProject\main.py", line 345, in task
    current_r, current_c, new_rgb = get_unset_pixel(get_board(access_tokens[credentials_index]), current_r,
  File "C:\Users\ilank\OneDrive\Desktop\pythonProject\main.py", line 178, in get_unset_pixel
    new_rgb = closest_color(target_rgb, rgb_colors_array)
  File "C:\Users\ilank\OneDrive\Desktop\pythonProject\main.py", line 62, in closest_color
    r, g, b = target_rgb
TypeError: cannot unpack non-iterable int object```

ValueError: too many values to unpack (expected 3)

Exception in thread Thread-4: Traceback (most recent call last): File "C:\Users\---\AppData\Local\Programs\Python\Python39\lib\threading.py", line 973, in _bootstrap_inner self.run() File "C:\Users\---\AppData\Local\Programs\Python\Python39\lib\threading.py", line 910, in run self._target(*self._args, **self._kwargs) File "F:\reddit-place-script-2022-main\main.py", line 492, in task current_r, current_c, new_rgb = get_unset_pixel( File "F:\reddit-place-script-2022-main\main.py", line 283, in get_unset_pixel new_rgb = closest_color(target_rgb, rgb_colors_array) File "F:\reddit-place-script-2022-main\main.py", line 111, in closest_color r, g, b = target_rgb ValueError: too many values to unpack (expected 3)

Colored outputs

Colored outputs for placing succeeded/failed would be nice and easy to add

[BUG] Place frequency not being honored

Bug Report Form

Checklist

  • [ Y ] I am using the latest version of the code.
  • [ Y ] I am absolutely sure I read the README in its entirety.
  • [ Y ] I have made sure this is not a duplicate issue.
  • [ Y ] I have filled out this form correctly.

Describe the bug

Time between places is more than the pixel place frequency. I'm randomy getting between 400 and 650 seconds between attempts to place instead of 330 like is set in the pixel_place_frequency variable.

To Reproduce

Run the bot. At least with my setup, I'm getting times upward of 650s/cycle.

Expected behavior

There should only be 330 seconds between checks.

Additional context

I've wracked my head over this and can't find out what's wrong. It's slowing the bot down a ton lmao.

TypeError: cannot unpack non-iterable int object

-------Thread #1-------
300 seconds until next pixel is drawn
Got image: https://hot-potato.reddit.com/media/canvas-images/1648890067498-0-f-Aw5FnlTA.png
Exception in thread Thread-11 (task):
Traceback (most recent call last):
  File "C:\Python310\lib\threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "C:\Python310\lib\threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
  File "D:\Botting\reddit-place-script-2022-main\main.py", line 470, in task
    current_r, current_c, new_rgb = get_unset_pixel(
  File "D:\Botting\reddit-place-script-2022-main\main.py", line 261, in get_unset_pixel
    new_rgb = closest_color(target_rgb, rgb_colors_array)
  File "D:\Botting\reddit-place-script-2022-main\main.py", line 95, in closest_color
    r, g, b = target_rgb
TypeError: cannot unpack non-iterable int object

this randomly started happening after restarting the program. didnt change any files.

placing incorrect pixel color

I have a purple pixel in the bottom right, but when I run the program, it attempts to place a cyan pixel there. any help?

Out of Bounds exception

currently on line 307, when it tries to do the 3rd iteration or when credentials_index is equal to 2, it crashes and throws an index out of range error. I'm not sure exactly why we are referencing ENV_R_START as it only has 2 values, x initial and y initial?
current_r = int(json.loads(os.getenv("ENV_R_START"))[credentials_index])

Multiple accounts support?

I feel like I can actually use multiple accounts by launching the script on different instances of my terminal (like, having multiple terminal tabs running the script).

received response: {"error": "invalid_grant"} error

Thread #0
refreshing access token...
received response: {"error": "invalid_grant"}
Exception in thread Thread-1:
Traceback (most recent call last):
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "main.py", line 208, in task
access_tokens[credentials_index] = response_data["access_token"]
KeyError: 'access_token'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.