Need help with the following error

Its_Cherry
New Member
4 0 0

self.endpoint = shopify.ShopifyResource.get_site() + "/graphql.json"
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

Replies 3 (3)
domnappa
Tourist
8 1 0

Looks like your "shopify.ShopifyResource.get_site()" function is returning something that isn't a String, what is that function returning? 

Don't forget to smash that Like button if I've helped you out!
If you're question was answered, don't forget to Accept the Solution!
Its_Cherry
New Member
4 0 0

Actually it is a library error

Its_Cherry
New Member
4 0 0

import shopify
from ..base import ShopifyResource
from six.moves import urllib
import json


class GraphQL:
def __init__(self):
self.endpoint = shopify.ShopifyResource.get_site() + "/graphql.json"
self.headers = shopify.ShopifyResource.get_headers()

def merge_headers(self, *headers):
merged_headers = {}
for header in headers:
merged_headers.update(header)
return merged_headers

def execute(self, query, variables=None):
endpoint = self.endpoint
default_headers = {"Accept": "application/json", "Content-Type": "application/json"}
headers = self.merge_headers(default_headers, self.headers)
data = {"query": query, "variables": variables}

req = urllib.request.Request(self.endpoint, json.dumps(data).encode("utf-8"), headers)

try:
response = urllib.request.urlopen(req)
return response.read().decode("utf-8")
except urllib.error.HTTPError as e:
print((e.read()))
print("")
raise e

 

"This is code of the shopifyapi library and it belongs to  graphql.py portion "