#925·portia

需要帮助来爬取 API

作者: TwangyMoney创建于 2023年8月14日更新于 2024年5月30日

有人能帮我解决这个问题吗? 我遇到了困难。对我来说,理解它如何工作感觉非常复杂。我要做的基本上就是: async def generate_response(instructions, history=None): if history is None: data = { "model": "GPT-3.5-turbo-16k-0613", "temperature": 0.75, "messages": [ {"role": "system", "content": instructions}, ] } else: data = { "model": "GPT-3.5-turbo-16k-0613", "temperature": 0.75, "messages": [ {"role": "system", "content": instructions}, *history, ] } endpoint = "https://gpt4.xunika.uk/api/OpenAI/v1/chat/completions" headers = { "Content-Type": "application/json", "Authorization": f"Bearer ak-wwwchatgptorguk", } try: async with aiohttp.ClientSession() as session: async with session.post(endpoint, headers=headers, json=data) as response: response_data = await response.json() print(f"response_data: {response.status}") choices = response_data["choices"] if choices: return choices[0]["message"]["content"] except aiohttp.ClientError as error: print("Error making the request:", error) 我如何在此处实现 portia,使其绕过 Cloudflare 并给我返回结果?

内容来源: scrapinghub/portia