-
Notifications
You must be signed in to change notification settings - Fork 30
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
Issue on docs #169
Comments
I have the same problem. Initially i thought it was base64, then binary. Nothing worked. Here is my workaround if you need a quick solution: This is in TS, but you can easily adjust it to python
|
The developer reached out on twitter/x and provided an example.
Much appreciated though!
Cheers to the dev for excellent communication.
…On Wed, Feb 19, 2025 at 11:35 AM Giannis Kotsakiachidis < ***@***.***> wrote:
I have the same problem. Initially i thought it was base64, then binary.
Nothing worked. Here is my workaround if you need a quick solution:
This is in TS, but you can easily adjust it to python
const apiUrl = `https://api.dub.co/qr?url=${url}` <https://api.dub.co/qr?url=$%7Burl%7D>;
const response = await fetch(apiUrl, {
method: "GET",
headers: {
Authorization: `Bearer [Your key goes here]`,
Accept: "image/png",
},
});
—
Reply to this email directly, view it on GitHub
<#169 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/APIUAETJVXX6AU7GKN6IW232QS6GXAVCNFSM6AAAAABVM3GM6OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRZGMZDANZRGQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
[image: gianniskotsas]*gianniskotsas* left a comment (dubinc/docs#169)
<#169 (comment)>
I have the same problem. Initially i thought it was base64, then binary.
Nothing worked. Here is my workaround if you need a quick solution:
This is in TS, but you can easily adjust it to python
const apiUrl = `https://api.dub.co/qr?url=${url}` <https://api.dub.co/qr?url=$%7Burl%7D>;
const response = await fetch(apiUrl, {
method: "GET",
headers: {
Authorization: `Bearer [Your key goes here]`,
Accept: "image/png",
},
});
—
Reply to this email directly, view it on GitHub
<#169 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/APIUAETJVXX6AU7GKN6IW232QS6GXAVCNFSM6AAAAABVM3GM6OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRZGMZDANZRGQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
For anyone looking here is the solution in Python from the developer:
'''!pip install --upgrade shortuuid
!pip install dub
from google.colab import files
import dub
import os
import shortuuid
from dub.models import operations
import requests
import base64
uploaded = files.upload()
d = dub.Dub(
server_url="https://api.dub.co",
token="dub_xxx"
)
def create_short_link():
res = None
try:
image_path = list(uploaded.keys())[0]
with open(image_path, 'rb') as image_file:
image_buffer = image_file.read()
image_base64 = base64.b64encode(image_buffer).decode('utf-8')
res = d.links.create(request={
"url": "https://google.com",
"proxy": True,
"image": image_base64
})
except Exception as e:
return str(e)
if res is not None:
return res.short_link
create_short_link()'''
…On Wed, Feb 19, 2025 at 11:35 AM Giannis Kotsakiachidis < ***@***.***> wrote:
I have the same problem. Initially i thought it was base64, then binary.
Nothing worked. Here is my workaround if you need a quick solution:
This is in TS, but you can easily adjust it to python
const apiUrl = `https://api.dub.co/qr?url=${url}` <https://api.dub.co/qr?url=$%7Burl%7D>;
const response = await fetch(apiUrl, {
method: "GET",
headers: {
Authorization: `Bearer [Your key goes here]`,
Accept: "image/png",
},
});
—
Reply to this email directly, view it on GitHub
<#169 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/APIUAETJVXX6AU7GKN6IW232QS6GXAVCNFSM6AAAAABVM3GM6OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRZGMZDANZRGQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
[image: gianniskotsas]*gianniskotsas* left a comment (dubinc/docs#169)
<#169 (comment)>
I have the same problem. Initially i thought it was base64, then binary.
Nothing worked. Here is my workaround if you need a quick solution:
This is in TS, but you can easily adjust it to python
const apiUrl = `https://api.dub.co/qr?url=${url}` <https://api.dub.co/qr?url=$%7Burl%7D>;
const response = await fetch(apiUrl, {
method: "GET",
headers: {
Authorization: `Bearer [Your key goes here]`,
Accept: "image/png",
},
});
—
Reply to this email directly, view it on GitHub
<#169 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/APIUAETJVXX6AU7GKN6IW232QS6GXAVCNFSM6AAAAABVM3GM6OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRZGMZDANZRGQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Path: /sdks/quickstart/python
It is not clear what encoding the QR codes are in.
Base64 seem standard but I didn't have any luck there.
Please put the information for QR codes directly in the examples if possible.
Thanks!
The text was updated successfully, but these errors were encountered: