Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in uploading stickers #4

Open
code-IM-perfect opened this issue Nov 11, 2021 · 32 comments
Open

Error in uploading stickers #4

code-IM-perfect opened this issue Nov 11, 2021 · 32 comments

Comments

@code-IM-perfect
Copy link

I'm using script_v2 on Ubuntu in WSL
The script downloaded all the dependencies
everything goes as it's supposed to go but then I get this-

# Time to upload pack!!!!
Pack wasn't uploaded Doing backup !!
Couldn't Upload hence backup created in folder .output/0 , rerun script to do Upload
Cleaning up

Then when I rerun the script it tells me that a backup was found and when I tell it to upload them, I get-
Please check network connection!!!

I obviously am connected to internet coz you can read this

@code-IM-perfect
Copy link
Author

PS: I think the script is unable to convert them in the first place (I can confirm they get downloaded tho)
image

@teynav
Copy link
Owner

teynav commented Dec 19, 2021

Hello what Linux Distribution are you using (Sorry for late followup)

@code-IM-perfect
Copy link
Author

I am using Ubuntu on WSL

@teynav
Copy link
Owner

teynav commented Dec 20, 2021

Have you made sure that you have all the dependencies installed ?

@teynav
Copy link
Owner

teynav commented Dec 22, 2021

Check if you have ffmpeg installed and tgs2png , I think one of them is missing for sure as my program is unable to count average frame delay

@tuschla
Copy link

tuschla commented Mar 1, 2022

Hey, I'm having both installed and getting the same error.

@tuschla
Copy link

tuschla commented Mar 1, 2022

I modified the script by removing the if condition so I'm now being shown the following error.
FileNotFoundError: [Errno 2] No such file or directory: 'result/0.png'

@teynav
Copy link
Owner

teynav commented Mar 2, 2022

I modified the script by removing the if condition so I'm now being shown the following error. FileNotFoundError: [Errno 2] No such file or directory: 'result/0.png'

This error mean a binary isn't functioning properly,

As i can see in other thread when you changed directory to the script this error disapper or am I wrong?

@tuschla
Copy link

tuschla commented Mar 2, 2022

As i can see in other thread when you changed directory to the script this error disapper or am I wrong?

No, I got this error after "fixing" the other error by changing directory. So it still persists.

I found the reason the tgs files are not converted and put in result or outputdir (in case of the rust program).

gzip: ./0.tgs: not in gzip format
ERR Can't open: testdir/./0/./0.tgs.json

This occurs with both the rust program as well as the bash script.

@tuschla
Copy link

tuschla commented Mar 2, 2022

Concerning the second error: this is how the testdir folder looks like on my machine (and probably should look like).

testdir
├── 0
│   └── 0.tgs.json
├── 1
│   └── 1.tgs.json
├── 10
│   └── 10.tgs.json
├── 11
│   └── 11.tgs.json
├── 12
│   └── 12.tgs.json
├── 13
│   └── 13.tgs.json
├── 14
│   └── 14.tgs.json
├── 15
│   └── 15.tgs.json

@tuschla
Copy link

tuschla commented Mar 2, 2022

# Tgs is gunzipped rllotie file
gunzip -c "$thefile" > $thedir/"$thefile".json

When doing gunzip -c 0.tgs > ./testdir/0/0.tgs.json by hand I also get the same (first) error. I'm attaching the file below. I can open this file (and oll the other .tgs files) without a problem with mpv and vlc and I can also open the static tgs files with gimp and feh. Are you sure this even has to be unzipped?

@tuschla
Copy link

tuschla commented Mar 2, 2022

0.tgs.zip
GIthub wouldn't let me upload tgs files so I had to zip it.

@tuschla
Copy link

tuschla commented Mar 2, 2022

When debugging it becomes clear why it can't open the json. The path joining (see below) is not working and is joining paths like this testdir/./5/./5.tgs.json when they should actually look like this testdir/5/5.tgs.json.

for file in ./*.tgs
do
jobbb=`jobs | wc -l`
while [[ $jobbb -ge "3" ]]
do
#echo "Total jobs = $(jobs | wc -l )"
sleep 5
jobbb=`jobs | wc -l`
done
batch=$(echo $file | sed "s/.tgs//g")
./core-hybrid $batch $file &
done

I fixed this by just removing the ./ in the for loop declaration.

for file in *.tgs 
do
  jobbb=`jobs | wc -l`
	while [[ $jobbb -ge "3" ]]
  do
		#echo "Total jobs = $(jobs | wc -l )"
    sleep 5
		jobbb=`jobs | wc -l`
  done 
	batch=$(echo $file | sed "s/.tgs//g")
	./core-hybrid $batch $file &
done 

So this is what the end of the debug log looked like before.

+ jobbb=2
+ [[ 2 -ge 3 ]]
++ echo ./7.tgs
++ sed s/.tgs//g
+ batch=./7
+ for file in ./*.tgs
+ ./core-hybrid ./7 ./7.tgs
++ jobs
++ wc -l
+ jobbb=2
+ [[ 2 -ge 3 ]]
ERR Can't open: testdir/./6/./6.tgs.json
++ echo ./8.tgs
++ sed s/.tgs//g
+ batch=./8
+ for file in ./*.tgs
+ ./core-hybrid ./8 ./8.tgs
++ jobs
++ wc -l
+ jobbb=2
+ [[ 2 -ge 3 ]]
ERR Can't open: testdir/./7/./7.tgs.json
++ echo ./9.tgs
++ sed s/.tgs//g
+ batch=./9
+ wait
+ ./core-hybrid ./9 ./9.tgs
ERR Can't open: testdir/./8/./8.tgs.json
ERR Can't open: testdir/./9/./9.tgs.json
+ uploader
+ python3 bot.py
+ info 'Pack wasn'\''t uploaded Doing backup !! '
+ [[ NO == '' ]]
+ echo 'Pack wasn'\''t uploaded Doing backup !! '
Pack wasn't uploaded Doing backup !! 
+ dobackup
+ [[ ! -d .backup ]]
+ [[ ! -f .back ]]
+ for i in {0..100..1}
+ [[ -d .backup/0 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/1 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/2 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/3 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/4 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/5 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/6 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/7 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/8 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/9 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/10 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/11 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/12 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/13 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/14 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/15 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/16 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/17 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/18 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/19 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/20 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/21 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/22 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/23 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/24 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/25 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/26 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/27 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/28 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/29 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/30 ]]
+ mkdir .backup/30
+ echo 30
+ cp -rf result .backup/30/
+ cp emoji .backup/30/
+ cp pack .backup/30/
+ log 'Couldn'\''t Upload hence backup created in folder .output/30 , rerun script to do Upload'
+ echo 'Couldn'\''t' Upload hence backup created in folder .output/30 , rerun script to do Upload
Couldn't Upload hence backup created in folder .output/30 , rerun script to do Upload
+ break
+ rm 0.tgs 10.tgs 11.tgs 12.tgs 13.tgs 14.tgs 15.tgs 16.tgs 17.tgs 18.tgs 19.tgs 1.tgs 20.tgs 21.tgs 22.tgs 23.tgs 24.tgs 25.tgs 26.tgs 27.tgs 28.tgs 29.tgs 2.tgs 30.tgs 31.tgs 32.tgs 33.tgs 34.tgs 35.tgs 36.tgs 37.tgs 38.tgs 39.tgs 3.tgs 40.tgs 41.tgs 42.tgs 43.tgs 44.tgs 45.tgs 46.tgs 47.tgs 48.tgs 49.tgs 4.tgs 50.tgs 51.tgs 52.tgs 53.tgs 54.tgs 55.tgs 56.tgs 57.tgs 58.tgs 59.tgs 5.tgs 60.tgs 61.tgs 62.tgs 63.tgs 64.tgs 65.tgs 66.tgs 67.tgs 68.tgs 69.tgs 6.tgs 7.tgs 8.tgs 9.tgs
+ let conv=13+1

And this is what it looked like afterwards.

+ batch=7
+ for file in *.tgs
+ ./core-hybrid 7 7.tgs

gzip: 6.tgs: not in gzip format
++ jobs
++ wc -l
+ jobbb=2
+ [[ 2 -ge 3 ]]
++ echo 8.tgs
++ sed s/.tgs//g
ERR Can't open: testdir/6/6.tgs.json
+ batch=8
+ for file in *.tgs
+ ./core-hybrid 8 8.tgs
++ jobs
++ wc -l

gzip: 7.tgs: not in gzip format
+ jobbb=2
+ [[ 2 -ge 3 ]]
++ echo 9.tgs
++ sed s/.tgs//g
ERR Can't open: testdir/7/7.tgs.json
+ batch=9
+ wait
+ ./core-hybrid 9 9.tgs

gzip: 8.tgs: not in gzip format
ERR Can't open: testdir/8/8.tgs.json

gzip: 9.tgs: not in gzip format
ERR Can't open: testdir/9/9.tgs.json
+ uploader
+ python3 bot.py
+ info 'Pack wasn'\''t uploaded Doing backup !! '
+ [[ NO == '' ]]
+ echo 'Pack wasn'\''t uploaded Doing backup !! '
Pack wasn't uploaded Doing backup !! 
+ dobackup
+ [[ ! -d .backup ]]
+ [[ ! -f .back ]]
+ for i in {0..100..1}
+ [[ -d .backup/0 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/1 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/2 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/3 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/4 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/5 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/6 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/7 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/8 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/9 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/10 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/11 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/12 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/13 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/14 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/15 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/16 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/17 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/18 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/19 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/20 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/21 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/22 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/23 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/24 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/25 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/26 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/27 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/28 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/29 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/30 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/31 ]]
+ continue
+ for i in {0..100..1}
+ [[ -d .backup/32 ]]
+ mkdir .backup/32
+ echo 32
+ cp -rf result .backup/32/
+ cp emoji .backup/32/
+ cp pack .backup/32/
+ log 'Couldn'\''t Upload hence backup created in folder .output/32 , rerun script to do Upload'
+ echo 'Couldn'\''t' Upload hence backup created in folder .output/32 , rerun script to do Upload
Couldn't Upload hence backup created in folder .output/32 , rerun script to do Upload
+ break
+ rm 0.tgs 10.tgs 11.tgs 12.tgs 13.tgs 14.tgs 15.tgs 16.tgs 17.tgs 18.tgs 19.tgs 1.tgs 20.tgs 21.tgs 22.tgs 23.tgs 24.tgs 25.tgs 26.tgs 2.tgs 3.tgs 4.tgs 5.tgs 6.tgs 7.tgs 8.tgs 9.tgs
+ let conv=1+1
+ for iii in "${

So it's exactly the same error but at least the path checks out. Anyone has an idea why this error is still happening?

@tuschla
Copy link

tuschla commented Mar 2, 2022

Ok, forget my comment above. I didn't realize the './' actually don't do anything really. Seemed like that was the error here but it isn't. :(

@teynav
Copy link
Owner

teynav commented Mar 3, 2022

Ok, forget my comment above. I didn't realize the './' actually don't do anything really. Seemed like that was the error here but it isn't. :(

Lol yeah that's true ./ Would just mean in the same directory so it won't change anything. Seems like the issue here is with gzip itself. Could you tell me about your setup so that i could try it out ( os and release) . I would be late in solving the bug because am busy with my finals but I will surely look into it after that.

Is the bug happening with rust version too?

@tuschla
Copy link

tuschla commented Mar 3, 2022

Yes the bug is happening with the rust version as well.
I use Arch Linux. gunzip --version gives me this.

gunzip (gzip) 1.11
Copyright (C) 2007, 2011-2018 Free Software Foundation, Inc.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <https://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.

Written by Paul Eggert.

@tuschla
Copy link

tuschla commented Mar 3, 2022

Can you maybe tell me why you're using gzip here? You're calling gzip on the tgs files and then writing it to stdout and piping it into a json file? What purpose does this try to serve? :)

@tuschla
Copy link

tuschla commented Mar 3, 2022

I added the the -f flag as stated in the man page:

Force compression or decompression even if the file has multiple links or the corresponding file already exists, or if the compressed data is read from or written to a terminal.
So we are writing data to a terminal so this flag should be added right? Maybe this behavior happens only in a newer version?

The following error still persists though.

ERR Can't open: testdir/./0/./0.tgs.json
ERR Can't open: testdir/./10/./10.tgs.json
ERR Can't open: testdir/./11/./11.tgs.json

@tuschla
Copy link

tuschla commented Mar 3, 2022

Tested this on Debian 11. Getting exactly the same error. What gzip version are you using for this to work?

@tuschla
Copy link

tuschla commented Mar 5, 2022

Ok, with the help of a friend I managed to pin down the issue and why it is happening. Thing is, the stickers I'm trying to download are not in rlottie format but are instead simply webm or png files, so of course gzip throws this error. This is probably the case for most of the stickers on Telegram except for the ones made by Telegram.

For static stickers this bot here works like a charm: https://github.com/signalstickers/Adhesive

@teynav
Copy link
Owner

teynav commented Mar 6, 2022

For static stickers this bot here works like a charm: https://github.com/signalstickers/Adhesive

Okay that makes sense given the bot is made for static stickers conversion, This project was clearly made for conversion of Animated stickers. Thanks for clearing it out though.

@tuschla
Copy link

tuschla commented Mar 6, 2022

I tried both animated stickers and static stickers. The animated stickers that internally use webm do also obviously not work.

@laggykiller
Copy link
Contributor

#7 adds support for webm stickers, which may solve this issue

@tuschla
Copy link

tuschla commented Dec 1, 2022

Hi, I tested your merge request but I still get the same error described all the way at the top of this issue. But it doesn't throw a bunch of errors in the process, so that is nice.

result/0.png corresponds to 😺
result/1.png corresponds to 😹
result/2.png corresponds to 😸
result/3.png corresponds to 😼
result/4.png corresponds to 😼
result/5.png corresponds to 😼
result/6.png corresponds to 😾
result/7.png corresponds to 😾
result/8.png corresponds to 😾
result/9.png corresponds to 😻
result/10.png corresponds to 😹
result/11.png corresponds to 😾
result/12.png corresponds to 😾
result/13.png corresponds to 🙀
result/14.png corresponds to 🙀
result/15.png corresponds to 😽
result/16.png corresponds to 😻
result/17.png corresponds to 👽
result/18.png corresponds to 😿
result/19.png corresponds to 😾
result/20.png corresponds to 😹
result/21.png corresponds to 🙀
result/22.png corresponds to 🙀
result/23.png corresponds to 😾
result/24.png corresponds to 😾
result/25.png corresponds to 😾
result/26.png corresponds to 😾
result/27.png corresponds to 😾
result/28.png corresponds to 😼
result/29.png corresponds to 😺
result/30.png corresponds to 😻
result/31.png corresponds to 😽
-->
Final stage Uploading is gonna start now!!!!!
token  =
author =
uuid (DO NOT SHARE)=
password (DO NOT SHARE)=
Pack name = 
-->
Pack wasn't uploaded Doing backup !! 
Couldn't Upload hence backup created in folder .output/0 , rerun script to do Upload

And when I rerun the script, I get

Please check network connection!!!

@tuschla
Copy link

tuschla commented Dec 1, 2022

The conversion results look good though!

@laggykiller
Copy link
Contributor

laggykiller commented Dec 1, 2022

@tuschla Go to script_v3 directory and runpython3 bot.py. What is the output?

@tuschla
Copy link

tuschla commented Dec 2, 2022

Doesn't seem related to your code.

Traceback (most recent call last):
  File "/home/lt/Documents/sticker/scripts_linux/script_v3/bot.py", line 77, in <module>
    anyio.run(main)
  File "/usr/lib/python3.10/site-packages/anyio/_core/_eventloop.py", line 70, in run
    return asynclib.run(func, *args, **backend_options)
  File "/usr/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 292, in run
    return native_run(wrapper(), debug=debug)
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/usr/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 287, in wrapper
    return await func(*args)
  File "/home/lt/Documents/sticker/scripts_linux/script_v3/bot.py", line 71, in main
    pack_id, pack_key = await client.upload_pack(pack)
  File "/usr/lib/python3.10/site-packages/signalstickers_client/stickersclient.py", line 70, in upload_pack
    return await uploader.upload_pack(self.http, pack, self.signal_user, self.signal_pass)
  File "/usr/lib/python3.10/site-packages/signalstickers_client/classes/uploader.py", line 23, in upload_pack
    register_resp = await http.get(SERVICE_STICKER_FORM_URL.format(
  File "/usr/lib/python3.10/site-packages/httpx/_client.py", line 1548, in get
    return await self.request(
  File "/usr/lib/python3.10/site-packages/httpx/_client.py", line 1371, in request
    response = await self.send(
  File "/usr/lib/python3.10/site-packages/httpx/_client.py", line 1406, in send
    response = await self._send_handling_auth(
  File "/usr/lib/python3.10/site-packages/httpx/_client.py", line 1444, in _send_handling_auth
    response = await self._send_handling_redirects(
  File "/usr/lib/python3.10/site-packages/httpx/_client.py", line 1476, in _send_handling_redirects
    response = await self._send_single_request(request, timeout)
  File "/usr/lib/python3.10/site-packages/httpx/_client.py", line 1501, in _send_single_request
    with map_exceptions(HTTPCORE_EXC_MAP, request=request):
  File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/usr/lib/python3.10/site-packages/httpx/_exceptions.py", line 343, in map_exceptions
    raise mapped_exc(message, **kwargs) from exc  # type: ignore
httpx.ConnectError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:997)

@laggykiller
Copy link
Contributor

laggykiller commented Dec 2, 2022

@tuschla You use Arch Linux right? Did you install self-signed SSL certificate?

Try pip install pip_system_certs OR pip install certifi --upgrade

---TRY ABOVE FIRST, DO NOT FOLLOW INSTRUCTIONS BELOW UNLESS IT DOES NOT WORK---

If above fail, try to add this to the top of bot.py (Ref: https://stackoverflow.com/questions/51390968/python-ssl-certificate-verify-error)

import ssl

try:
    _create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
    # Legacy Python that doesn't verify HTTPS certificates by default
    pass
else:
    # Handle target environment that doesn't support HTTPS verification
    ssl._create_default_https_context = _create_unverified_https_context

An even more hacky way is go to /usr/lib/python3.10/site-packages/signalstickers_client/classes/uploader.py and change line 23-27 from:

    register_resp = await http.get(SERVICE_STICKER_FORM_URL.format(
        nb_stickers=pack.nb_stickers_with_cover),
        auth=(signal_user, signal_password),
        timeout=None,
    )

to:

    register_resp = await http.get(SERVICE_STICKER_FORM_URL.format(
        nb_stickers=pack.nb_stickers_with_cover),
        auth=(signal_user, signal_password),
        timeout=None, verify=False,
    )

(Ref: https://www.python-httpx.org/advanced/)

@tuschla
Copy link

tuschla commented Dec 2, 2022

Try pip install pip_system_certs OR pip install certifi --upgrade

Does not change anything unfortunately.

If above fail, try to add this to the top of bot.py (Ref: https://stackoverflow.com/questions/51390968/python-ssl-certificate-verify-error)

import ssl

try:
    _create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
    # Legacy Python that doesn't verify HTTPS certificates by default
    pass
else:
    # Handle target environment that doesn't support HTTPS verification
    ssl._create_default_https_context = _create_unverified_https_context

Does also not work.

An even more hacky way is go to /usr/lib/python3.10/site-packages/signalstickers_client/classes/uploader.py and change line 23-27 from:

register_resp = await http.get(SERVICE_STICKER_FORM_URL.format(
    nb_stickers=pack.nb_stickers_with_cover),
    auth=(signal_user, signal_password),
    timeout=None,
)

to:

register_resp = await http.get(SERVICE_STICKER_FORM_URL.format(
    nb_stickers=pack.nb_stickers_with_cover),
    auth=(signal_user, signal_password),
    timeout=None, verify=False,
)

This gives me this error.

  File "/home/lt/Documents/sticker/scripts_linux/script_v3/bot.py", line 77, in <module>
    anyio.run(main)
  File "/usr/lib/python3.10/site-packages/anyio/_core/_eventloop.py", line 70, in run
    return asynclib.run(func, *args, **backend_options)
  File "/usr/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 292, in run
    return native_run(wrapper(), debug=debug)
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/usr/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 287, in wrapper
    return await func(*args)
  File "/home/lt/Documents/sticker/scripts_linux/script_v3/bot.py", line 71, in main
    pack_id, pack_key = await client.upload_pack(pack)
  File "/usr/lib/python3.10/site-packages/signalstickers_client/stickersclient.py", line 70, in upload_pack
    return await uploader.upload_pack(self.http, pack, self.signal_user, self.signal_pass)
  File "/usr/lib/python3.10/site-packages/signalstickers_client/classes/uploader.py", line 23, in upload_pack
    register_resp = await http.get(SERVICE_STICKER_FORM_URL.format(
TypeError: AsyncClient.get() got an unexpected keyword argument 'verify'

@laggykiller
Copy link
Contributor

laggykiller commented Dec 2, 2022

@tuschla Sorry my bad. The final method should be change /usr/lib/python3.10/site-packages/signalstickers_client/stickersclient.py line 37 self.http: httpx.AsyncClient to self.http: httpx.AsyncClient(verify=False)
Ref: https://github.com/encode/httpx/blob/master/httpx/_client.py#L1297

But on second thought, please try pip install signalstickers_client --upgrade first!

The error occured because that package is in fact using custom cacert, as seen from /usr/lib/python3.10/site-packages/signalstickers_client/stickersclient.py line 32 from signalstickers_client.utils.ca import CACERT_PATH

CACERT_PATH is used on line 42 self.http = await httpx.AsyncClient(verify=CACERT_PATH).__aenter__()

CACERT_PATH is /usr/lib/python3.10/site-packages/signalstickers_client/utils/ca/cacert.pem

signalstickers/signalstickers-client#13 says that CA cert was changed recently.

PS: Please revert the changes done to bot.py and /usr/lib/python3.10/site-packages/signalstickers_client/classes/uploader.py

@tuschla
Copy link

tuschla commented Dec 2, 2022

No need to apologize, I also couldn't find anything to fix it. pip install signalstickers_client --upgrade did the trick. Now it runs flawlessly all the way through. Nice work with the conversion part!

@teynav
Copy link
Owner

teynav commented Dec 9, 2022

Sorry guys was busy with my exams, I tried uploading a pack and it works, am I missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants