Skip to content

Commit 3df4fa4

Browse files
committed
update readme, get message fix
1 parent b98cbb8 commit 3df4fa4

File tree

9 files changed

+26
-6
lines changed

9 files changed

+26
-6
lines changed

.env.template

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# .env // template
2+
3+
NEYNAR_KEY=

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,14 @@ for an example that uses on-chain frame transactions, see the [weth frame](https
4141

4242
and for a more advanced example involving multiplayer games, supabase integration, dynamic image rendering, and more,
4343
see [rock paper scissors](https://github.com/devinaconley/rock-paper-scissors)
44+
45+
46+
## roadmap
47+
48+
upcoming features and improvements
49+
- mint actions
50+
- eip 712 signatures
51+
- generated library documentation
52+
- dynamic image rendering tools
53+
- compatibility with other web frameworks
54+
- state signing

examples/simple/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# requirements.txt
2-
framelib~=0.0.4
2+
framelib~=0.0.5
33
Flask~=3.0.1
44
pydantic
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# requirements.txt
2-
framelib~=0.0.4
2+
framelib~=0.0.5
33
Flask~=3.0.1
44
pydantic

framelib/hub.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ def get_message(
2626
auth = (username, password)
2727

2828
res = requests.post(url, headers=headers, auth=auth, data=bytes.fromhex(msg))
29+
if res.status_code != 200:
30+
raise ValueError(f'hub error [{res.status_code}] {res.text}')
2931

3032
if res.status_code != 200:
3133
raise ValueError(f'failed to validate message with hub: {res.text}')

framelib/models.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ class NeynarInteractor(BaseModel):
108108
follower_count: int
109109
following_count: int
110110
verifications: list[str]
111-
active_status: str
112111
viewer_context: Optional[NeynarViewer] = None
113112

114113

framelib/neynar.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ def get_frame_message(msg: str, api_key: str) -> NeynarValidatedMessage:
2828
}
2929

3030
res = requests.post(url, json=body, headers=headers)
31+
if res.status_code != 200:
32+
raise ValueError(f'neynar error [{res.status_code}] {res.text}')
3133

3234
if res.status_code != 200:
3335
raise ValueError(f'failed to validate message with neynar: {res.text}')

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name='framelib',
8-
version='0.0.4',
8+
version='0.0.5',
99
author='Devin A. Conley',
1010
author_email='[email protected]',
1111
description='lightweight library for building farcaster frames using python and flask',

test/test_validation.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,23 @@
33
"""
44

55
# lib
6+
import os
7+
from dotenv import load_dotenv
68
import pytest
79

810
# src
911
from framelib import validate_message
1012
from framelib.neynar import get_frame_message
1113
from framelib.hub import get_message
1214

15+
load_dotenv()
1316

1417
class TestValidateMessageNeynar(object):
1518

1619
def test_button_1(self):
1720
# example signed message from fid 8268 clicking button 1
1821
msg = '0a4e080d10cc4018cbe1a230200182013f0a2068747470733a2f2f707974686f6e2d6672616d652e76657263656c2e6170702f10011a1908cc401214000000000000000000000000000000000000000112140101bf04a2e61cb24c9a66c047ac5ed175e1bed8180122403feee9d0c1392c1e5bc7bca49850f83735c53b4f60c88959ffc271123e333a196e963d15619125e6034acda36076c709182daa5625e4affe6df21866c204830828013220ad4520314a78bc4317c604a3324ebc25bd8215c3ac38342fd790b7905c291bd1'
19-
action = get_frame_message(msg, 'NEYNAR_API_DOCS')
22+
action = get_frame_message(msg, os.getenv('NEYNAR_KEY'))
2023
assert action.tapped_button.index == 1
2124
assert action.interactor.fid == 8268
2225
assert action.input is None
@@ -36,7 +39,7 @@ def test_button_1(self):
3639
def test_button_1_neynar(self):
3740
# example signed message from fid 8268 clicking button 1
3841
msg = '0a4e080d10cc4018cbe1a230200182013f0a2068747470733a2f2f707974686f6e2d6672616d652e76657263656c2e6170702f10011a1908cc401214000000000000000000000000000000000000000112140101bf04a2e61cb24c9a66c047ac5ed175e1bed8180122403feee9d0c1392c1e5bc7bca49850f83735c53b4f60c88959ffc271123e333a196e963d15619125e6034acda36076c709182daa5625e4affe6df21866c204830828013220ad4520314a78bc4317c604a3324ebc25bd8215c3ac38342fd790b7905c291bd1'
39-
action = get_message(msg, 'https://hub-api.neynar.com', api_key='NEYNAR_API_DOCS')
42+
action = get_message(msg, 'https://hub-api.neynar.com', api_key=os.getenv('NEYNAR_KEY'))
4043
assert action.data.frameActionBody.buttonIndex == 1
4144
assert action.data.fid == 8268
4245
assert action.data.network == 'FARCASTER_NETWORK_MAINNET'

0 commit comments

Comments
 (0)