<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Python Requests fail in Dynatrace API</title>
    <link>https://community.dynatrace.com/t5/Dynatrace-API/Python-Requests-fail/m-p/116635#M787</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Please remove the trailing ')' from your code on line three (the end of the URL) as it fails to compile due to that one.&lt;/P&gt;&lt;P&gt;Once that's resolved it will also fail on line 4 as the API token needs to be within the quotes, it's not a variable.&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;</description>
    <pubDate>Thu, 10 Sep 2020 10:00:36 GMT</pubDate>
    <dc:creator>Mike_L</dc:creator>
    <dc:date>2020-09-10T10:00:36Z</dc:date>
    <item>
      <title>Python Requests fail</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/Python-Requests-fail/m-p/116634#M786</link>
      <description>&lt;P&gt;I get an invalid syntax trying to use the requests library in Python. I've used the same syntax as this: &lt;A href="https://community.dynatrace.com/questions/241885/how-to-get-data-from-dynatrace-api-using-python-re.html" target="_blank" rel="noopener noreferrer"&gt;https://community.dynatrace.com/questions/241885/how-to-get-data-from-dynatrace-api-using-python-re.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;import requests&lt;BR /&gt;&lt;BR /&gt;URL = "https://somehostname.live.dynatrace.com/api/v2/metrics/query?metricSelector=builtin%3Asynthetic.browser.totalDuration&amp;amp;from=now-2d&amp;amp;to=now-1d")&lt;BR /&gt;headers = {'Authorization': "Api-Token " + 123456Token123456}&lt;BR /&gt;&lt;BR /&gt;r = requests.get(url, headers=headers)&lt;BR /&gt;print(r)&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;But get invalid syntax errors:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;Traceback (most recent call last):&lt;BR /&gt;&amp;nbsp; File "C:\Users\leica\Documents\Python\muckingabout.py", line 3&lt;BR /&gt;&amp;nbsp; &amp;nbsp; URL = "https://somehostname.live.dynatrace.com/api/v2/metrics/query?metricSelector=builtin%3Asynthetic.browser.totalDuration&amp;amp;from=now-2d&amp;amp;to=now-1d")&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;^&lt;BR /&gt;SyntaxError: invalid syntax&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2023 14:20:58 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/Python-Requests-fail/m-p/116634#M786</guid>
      <dc:creator>Lisa_Singh01</dc:creator>
      <dc:date>2023-10-16T14:20:58Z</dc:date>
    </item>
    <item>
      <title>Re: Python Requests fail</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/Python-Requests-fail/m-p/116635#M787</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Please remove the trailing ')' from your code on line three (the end of the URL) as it fails to compile due to that one.&lt;/P&gt;&lt;P&gt;Once that's resolved it will also fail on line 4 as the API token needs to be within the quotes, it's not a variable.&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 10:00:36 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/Python-Requests-fail/m-p/116635#M787</guid>
      <dc:creator>Mike_L</dc:creator>
      <dc:date>2020-09-10T10:00:36Z</dc:date>
    </item>
  </channel>
</rss>

