cristian
cristian

Reputation: 526

Why Django/Python request doesn't work from production server?

I work on a Django application. From python code I make a post to Zoom server:

...
1) conn = http.client.HTTPSConnection("api.zoom.us")
...
2) conn.request("POST", "https://api.zoom.us/v2/users/me/meetings", headers=headers, body=body)

Headers and body are previously defined.

This request is working from localhost but not from hosting server. I get the following error when running the second code-line with no other details:

ConnectionRefusedError

On hosting server I tried also to send the POST requests from terminal with curl command and it worked just fine.

Any suggestion on what might be wrong ?

Upvotes: 1

Views: 626

Answers (2)

Glenn
Glenn

Reputation: 5776

You are probably doing this from a free PythonAnywhere account. Free accounts need to use the proxy to connect to the internet. Search for "Connection refused" in the PythonAnywhere help pages for the page that has the details for the proxy.

Upvotes: 0

crimsonpython24
crimsonpython24

Reputation: 2383

This is what I get when I tried accessing the second site:

<error>
  <code>124</code>
  <message>Invalid access token.</message>
</error>

That's industry-standard protection from code that might endanger the server. What might've happened is that the curl command has a built-in token that allows access into Zoom (or more likely Zoom has enabled access from curl), but I'm positive that you need to get some sort of permission to get into Zoom's server if you're running a custom site.

Upvotes: 0

Related Questions