Skip to content

Commit 3ec2740

Browse files
committed
Remove dependency on requests
1 parent 1b9faf2 commit 3ec2740

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description = "tiktoken is a fast BPE tokeniser for use with OpenAI's models"
55
readme = "README.md"
66
license = {file = "LICENSE"}
77
authors = [{name = "Shantanu Jain"}, {email = "[email protected]"}]
8-
dependencies = ["regex>=2022.1.18", "requests>=2.26.0"]
8+
dependencies = ["regex>=2022.1.18"]
99
optional-dependencies = {blobfile = ["blobfile>=2"]}
1010
requires-python = ">=3.8"
1111

tiktoken/load.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import uuid
99
from typing import Optional
1010

11-
import requests
11+
import urllib.request
1212

1313

1414
def read_file(blobpath: str) -> bytes:
@@ -22,9 +22,9 @@ def read_file(blobpath: str) -> bytes:
2222
with blobfile.BlobFile(blobpath, "rb") as f:
2323
return f.read()
2424
# avoiding blobfile for public files helps avoid auth issues, like MFA prompts
25-
resp = requests.get(blobpath)
26-
resp.raise_for_status()
27-
return resp.content
25+
with urllib.request.urlopen(blobpath) as response:
26+
resp = response.read()
27+
return resp
2828

2929

3030
def check_hash(data: bytes, expected_hash: str) -> bool:

0 commit comments

Comments
 (0)