Problem with %2B in Dall-e URL

Hi,
some Dall-e URLs do not work properly. The part “%2B” in the Dall-e URL generates the following problem:
When I want to upload the URL to Instagram with “requests.post(url)”, then Instagram thinks this part of the URL is a “+” sign, converts and replaces it, and the upload to Instagram fails.

Any proposal how to solve this? I am searching in the web since several days now, but everything I tried so far does not work.

Thanks.

The behavior is likely in the URL percent encoding part of the instagram code library that you are using. You’d have to find how to pass the URL without alteration, and if such is supported by the API backend and is still understood by the instagram fetcher.

1 Like

Unfortunately Instagram does not have that option.

Can the programmers from Dall-e just avoid “%2B” to be generated as part from “sig=”?

Does anyone know who to contact?

Perhaps the solution is one where you do the work:

  1. Fetch Dall-E image
  2. serve image
  3. API → your link
  4. Instagram fetches from you

In principle that’s a good idea. Sending the pic from local to Insta directly does not work unfortunately. I would first need to upload it to a web server and then send it from there.

I was hoping to avoid these interim steps.

Is there a developer in OpenAI responsible for the creation of the URL I can contact? It would be great to just avoid “%2B” in the URL that is generated.

Guess other users will run into the same problem.

Thanks.

couple of potential solutions

from urllib.parse import quote
import requests

url = 'https://your_dall_e_url_with_%2B'
encoded_url = quote(url, safe='')  
# safe='' ensures that all characters are encoded

# Now use encoded_url for your post request
requests.post(encoded_url)

or maybe

url = 'https://your_dall_e_url_with_%2B'
url = url.replace('%2B', '%252B')  # URL encode the '+' character only

# Now use the new URL for your post request
requests.post(url)

Hi Foxabilo,
Cool. Manually replacing ‘%2B’ with ‘%252B’ works on postman. I will try on the Raspberry when I am back home tonight.

1 Like

Hi Foxabilo,
works like a charm as well on the Raspi. Thanks!

If anyone is interested, here is the link where the Raspi uploads the Dall-e generated weather forecast to Insta 3x per day: https://www.instagram.com/p/CuZA9z0RoAW/?utm_source=ig_web_copy_link&igshid=MzRlODBiNWFlZA==

1 Like