mirror of
https://gitlab.com/gnh1201/pylingva.git
synced 2024-11-26 07:22:06 +00:00
Fix crash with special characters
This commit is contained in:
parent
eca28a9095
commit
f57385fe56
|
@ -1,5 +1,6 @@
|
|||
#! /usr/bin/env python
|
||||
|
||||
import urllib.parse
|
||||
import requests as req
|
||||
|
||||
class pylingva:
|
||||
|
@ -35,6 +36,7 @@ class pylingva:
|
|||
return lang
|
||||
|
||||
def translate(self, source, target, text):
|
||||
text = urllib.parse.quote(text, safe='')
|
||||
url = f"{self.url}/{source}/{target}/{text}"
|
||||
url = url.replace("?", "%3F")
|
||||
r = req.get(url)
|
||||
|
|
Loading…
Reference in New Issue
Block a user