Skip to content

Commit

Permalink
Merge pull request #77 from Chainlit/wd/follow-redirects
Browse files Browse the repository at this point in the history
fix: allow follow redirection
  • Loading branch information
willydouhard authored Jun 3, 2024
2 parents 8e32938 + c4f373e commit 8074b9b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions literalai/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def raise_error(error):
raise Exception(error)

variables = self._prepare_variables(variables)
with httpx.Client() as client:
with httpx.Client(follow_redirects=True) as client:
response = client.post(
self.graphql_endpoint,
json={"query": query, "variables": variables},
Expand Down Expand Up @@ -225,7 +225,7 @@ def make_rest_call(self, subpath: str, body: Dict[str, Any]) -> Dict:
Returns:
Dict: The JSON response from the REST API endpoint.
"""
with httpx.Client() as client:
with httpx.Client(follow_redirects=True) as client:
response = client.post(
self.rest_endpoint + subpath,
json=body,
Expand Down Expand Up @@ -643,7 +643,7 @@ def upload_file(

path = "/api/upload/file"

with httpx.Client() as client:
with httpx.Client(follow_redirects=True) as client:
response = client.post(
f"{self.url}{path}",
json=body,
Expand Down Expand Up @@ -679,7 +679,7 @@ def upload_file(
# Note: The content_type parameter is not needed here, as the correct MIME type should be set in the 'Content-Type' field from upload_details
form_data["file"] = (id, content, mime)

with httpx.Client() as client:
with httpx.Client(follow_redirects=True) as client:
if upload_type == "raw":
upload_response = client.request(
url=url,
Expand Down Expand Up @@ -1364,7 +1364,7 @@ def raise_error(error):

variables = self._prepare_variables(variables)

async with httpx.AsyncClient() as client:
async with httpx.AsyncClient(follow_redirects=True) as client:
response = await client.post(
self.graphql_endpoint,
json={"query": query, "variables": variables},
Expand Down Expand Up @@ -1407,7 +1407,7 @@ async def make_rest_call(self, subpath: str, body: Dict[str, Any]) -> Dict:
Returns:
Dict: The JSON response from the REST API endpoint.
"""
async with httpx.AsyncClient() as client:
async with httpx.AsyncClient(follow_redirects=True) as client:
response = await client.post(
self.rest_endpoint + subpath,
json=body,
Expand Down Expand Up @@ -1852,7 +1852,7 @@ async def upload_file(

path = "/api/upload/file"

async with httpx.AsyncClient() as client:
async with httpx.AsyncClient(follow_redirects=True) as client:
response = await client.post(
f"{self.url}{path}",
json=body,
Expand Down Expand Up @@ -1888,7 +1888,7 @@ async def upload_file(
# Note: The content_type parameter is not needed here, as the correct MIME type should be set in the 'Content-Type' field from upload_details
form_data["file"] = (id, content, mime)

async with httpx.AsyncClient() as client:
async with httpx.AsyncClient(follow_redirects=True) as client:
if upload_type == "raw":
upload_response = await client.request(
url=url,
Expand Down
2 changes: 1 addition & 1 deletion literalai/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.0.604"
__version__ = "0.0.605"
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="literalai",
version="0.0.604", # update version in literalai/version.py
version="0.0.605", # update version in literalai/version.py
description="An SDK for observability in Python applications",
author="Literal AI",
package_data={"literalai": ["py.typed"]},
Expand Down

0 comments on commit 8074b9b

Please sign in to comment.