Created
June 13, 2018 22:48
-
-
Save alairock/c340a7ab7216a5bf729b7b8f2458e547 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
headers = { | |
"Rest-Impersonate-User": userid, | |
"Rest-User-Token": "XXXXXXXXXXXXXXXXXXXXXXX", | |
} | |
try: | |
json = { | |
'ThreadId': thread_id, | |
'ForumId': 21, | |
'Body': data['raw'], | |
'PostDate': data['created_at'].strftime("%Y-%m-%d %H:%M:%S") | |
} | |
post(f"{base_url}/api.ashx/v2/forums/21/threads/{thread_id}/replies.json", json=json, headers=headers) as resp: | |
if resp.status != 200: | |
print('post status', resp.text) | |
else: | |
print('success') | |
return resp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
headers = { | |
"Rest-Impersonate-User": userid, | |
"Rest-User-Token": "XXXXXXXXXXXXXXXXXXXXXXX", | |
} | |
try: | |
json = { | |
'ForumId': 21, | |
'Subject': data['title'], | |
'Body': data['raw'], | |
'PostDate': data['created_at'].strftime("%Y-%m-%d %H:%M:%S") | |
} | |
post(f"{base_url}/api.ashx/v2/forums/21/threads.json", json=json, headers=headers) as resp: | |
if resp.status != 200: | |
print('post status', resp.text) | |
else: | |
print('success') | |
return resp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment