Merge pull request #104 from codl/fix-string-ids
fix string id support to also include in_reply_to_... fields
This commit is contained in:
commit
52d57d9d43
S'han modificat 1 arxius amb 8 adicions i 11 eliminacions
|
@ -17,6 +17,7 @@ import re
|
||||||
import copy
|
import copy
|
||||||
import threading
|
import threading
|
||||||
import sys
|
import sys
|
||||||
|
import six
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
@ -1083,17 +1084,13 @@ class Mastodon:
|
||||||
"""
|
"""
|
||||||
Converts json string IDs to native python bignums.
|
Converts json string IDs to native python bignums.
|
||||||
"""
|
"""
|
||||||
if sys.version_info.major >= 3:
|
for key in ('id', 'in_reply_to_id', 'in_reply_to_account_id'):
|
||||||
str_type = str
|
if (key in json_object and
|
||||||
else:
|
isinstance(json_object[key], six.text_type)):
|
||||||
str_type = unicode
|
try:
|
||||||
|
json_object[key] = int(json_object[key])
|
||||||
if ('id' in json_object and
|
except ValueError:
|
||||||
isinstance(json_object['id'], str_type)):
|
pass
|
||||||
try:
|
|
||||||
json_object['id'] = int(json_object['id'])
|
|
||||||
except ValueError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return json_object
|
return json_object
|
||||||
|
|
||||||
|
|
Loading…
Referencia en una nova incidència