Skip to content

fastspec rewrite#4

Open
KeremTurgutlu wants to merge 2 commits into
mainfrom
fastspec-rewrite
Open

fastspec rewrite#4
KeremTurgutlu wants to merge 2 commits into
mainfrom
fastspec-rewrite

Conversation

@KeremTurgutlu
Copy link
Copy Markdown

@KeremTurgutlu KeremTurgutlu commented May 28, 2026

  • fastcflare api now uses fastspec, group and method names are unchanged
  • The api is now async
  • I couldn't figure out the following env vars so commented out tests that need them for now:
# acctok = os.environ['CLOUDFLARE_ACC_TOK']
# acctid = os.environ['CLOUDFLARE_ACCT_ID']
# acceml = os.environ['CLOUDFLARE_EML_ADD']
  • Got Unauthorized to access requested resource error when I tried to test the bits inside the CloudflareApi.create_token method

@KeremTurgutlu KeremTurgutlu requested a review from jph00 May 28, 2026 11:42
Comment thread fastcflare/core.py
Comment on lines +65 to +77
from fastspec.oapi import OpFunc, _join_url, _path

# %% ../nbs/00_core.ipynb #3d08fed8
@patch
async def __call__(self:OpFunc, *args, **kwargs):
stream, headers, route, query, body, files = self._split(self._bind(args, kwargs))
url = _join_url(self.base_url, _path(self.path, route_params=route))
if files: kw = dict(body=None, files=files, data=self.form_encoder(body) or None)
elif self.request_content_type == "application/x-www-form-urlencoded": kw = dict(body=None, data=self.form_encoder(body))
else: kw = dict(body=body)
if stream: return self._stream(url, headers=headers, query=query, route=route, **kw)
return dict2obj(await self._request(url, headers=headers, query=query, route=route, **kw))

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to patch OpFunc.__call__ to wrap the response with dict2obj, adding it directly to fastspec caused issues in fastllm even with obj2dict denormalization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant